#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  string s;
  int TT;
  cin >> TT;
  for (int T = 1; T <= TT; T++) {
    cin >> n >> s;
    string res = "";
    int Cnt[2] = {0, 0};
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '1' && Cnt[0] == 0) {
        res += '1';
        continue;
      } else if (s[i] == '1' && Cnt[0] > 0) {
        Cnt[0] = 1;
        continue;
      } else if (s[i] == '0') {
        Cnt[0]++;
      }
    }
    while (Cnt[0] > 0) {
      res += '0';
      Cnt[0]--;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
  }
  return 0;
}
