#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define a first
#define b second

void solve(){
    int n; cin>>n;
    string b; cin>>b;
    vector<int> a(n);
    int prev{-1};
    for(int i=0;i<n;i++){
        if(b[i]=='1'){
            if(prev==2){
                a[i]=0;
                prev=1;
            }
            else{
                a[i]=1;
                prev=2;
            }
        }
        if(b[i]=='0'){
            if(prev==1){
                a[i]=0;
                prev=0;
            }
            else {
                a[i]=1;
                prev=1;
            }
        }
    }
    for(int i=0;i<n;i++) cout<<a[i];
    cout<<endl;
}

int main(){
    int t; cin>>t;
    while(t-->0){
        solve();
    }

}
