#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int t, n, ans;
deque<int>q;
unordered_set<int>uset;
int main(){
cin >> t;
while(t--){
q.clear();
uset.clear();
ans = 0;
cin >> n;
for(int i = 1; i <= n; i++){
int x;
cin >> x;
if(uset.find(x) != uset.end()){
while(q.size() && q.front() != x){
uset.erase(q.front());
q.pop_front();
}
uset.erase(x);
q.pop_front();
}
q.push_back(x);
uset.insert(x);
ans = max(ans, (int)uset.size());
}
cout << ans;
if(t != 0) cout << endl;
}
return 0;
}
最后一行也处理了 求条 真不知道哪里错了