#include <bits/stdc++.h>
using namespace std;
const int MAX = 500005;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string ans;
    int i, j;
    for (i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        ans += '1';
      } else {
        break;
      }
    }
    for (j = 0; j <= i; j++) {
      if (s[j] == '1') {
        break;
      } else {
        ans += '0';
      }
    }
    if (n == 1) {
      cout << s << endl;
      continue;
    }
    string q = ans;
    reverse(q.begin(), q.end());
    if (q == s) {
      cout << s << endl;
      continue;
    }
    if (j != i) {
      ans += '0';
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
  }
  return 0;
}
