#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string s;       cin >> s;       int left0 = 0;       for (int i = 0; i < n; i++) {         if (s[i] ==  0 ) {           left0 = i + 1;         } else {           break;         }       }       int right1 = 0;       for (int i = n - 1; i >= 0; i--) {         if (s[i] ==  1 ) {           right1 = right1 + 1;         } else {           break;         }       }       for (int i = 0; i < left0; i++) {         cout << 0;       }       if (left0 + right1 == n - 1 && (left0 != 0 || right1 != 0)) {         cout << s[left0];       } else if (left0 + right1 != n) {         cout << 0;       }       for (int i = 0; i < right1; i++) {         cout << 1;       }       cout <<   n ;     }     return 0;   }   