#include<bits/stdc++.h>
using namespace std;
stack<int> s;
unordered_map<int,bool> vis;
int main(){
// freopen("test.out","w",stdout);
int T;
cin>>T;
while(T--){
vis.clear();
int n;
cin>>n;
for(int i=1;i<=n;++i){
char ch;
cin>>ch;
int x;
cin>>x;
if(ch=='+'){
while(vis[x]){
int t=s.top();
s.pop();
vis[t]=0;
putchar('-');
}
s.push(x);
vis[x]=1;
putchar('+');
}
if(ch=='T') putchar('?');
if(ch=='F'){
while(vis[x]){
int t=s.top();
s.pop();
vis[t]=0;
putchar('-');
}
putchar('?');
}
}
while(!s.empty()){
int t=s.top();
s.pop();
vis[t]=0;
putchar('-');
}
puts("");
}
return 0;
}求调 Wa on #5