记录
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
map<int,vector<int> > b;
int a[100005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while (t--)
{
int n;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a[i];
b[a[i]].push_back(i);
}
int q;
cin>>q;
for (int i=1;i<=q;i++)
{
int l,r,pos;
cin>>l>>r>>pos;
int temp1=lower_bound(b[pos].begin(),b[pos].end(),l)-b[pos].begin();
int temp2=upper_bound(b[pos].begin(),b[pos].end(),r)-b[pos].begin()-1;
cout<<temp2-temp1+1<<endl;
}
}
}