#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int tc; cin >> tc; while(tc--) { int n; string s; cin >> n; cin >> s; while(n > 0) { int cnt0 = 0; int cnt1 = 0; for(auto ch : s) { if(ch=='0') cnt0+=1; else cnt1+=1; } if(cnt0==0 || cnt1==0) break; s.pop_back(); s = s[0] + s; n-=1; } cout << s << '\n'; } return 0; }