#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int T;
  cin >> T;
  while (T--) {
    int n;
    string s;
    cin >> n >> s;
    string t = "", t2 = "";
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        t.push_back('1');
        s.pop_back();
      } else
        break;
    }
    bool b = false;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '0')
        t2.push_back('0');
      else {
        b = true;
        break;
      }
    }
    if (b)
      cout << t2 << '0' << t << "\n";
    else
      cout << t2 << t << "\n";
  }
}
