#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  string s;
  cin >> t;
  while (t--) {
    string ans = "";
    cin >> n >> s;
    for (int i = n - 1; i >= 0; i--) {
      ans = s[i] + ans;
      if (s[i] == '0') {
        i--;
        string k = "";
        while (i >= 0) {
          if (s[i] == '1')
            k = "";
          else
            k = s[i] + k;
          i--;
        }
        ans = k + ans;
        break;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
