#include <bits/stdc++.h>
using namespace std;
//SET PRECIOSION   cout << fixed ;  cout << setprecision(n) << ans << endl;
#define ll long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector <ll> v;
ll x,y,z,a,b,c,sum,ans,total,t,cnt,n,m,k,p,q,r,l,w,right,left,row,col,kase;
string s1,s2;
map<ll,ll> mp;
set<ll> s;
map<ll,ll> :: iterator itr1, ptr1;
set<ll> :: iterator itr, ptr;

int main()
{
	///Peace be with you.
	FAST;
	cin>>t;
	while(t--)
    {
        cin>>n;
        cin>>s1;
        ll x = 2;
        v.resize(n+1);

        v[0] = -1;
        for(ll i=0; i<n; i++)
        {
            if(s1[i] == '1')
            {
              if(v[i] == 2)
              {
                  cout<<0;
                  v[i+1] = 1;
              }
              else
              {
                  cout<<1;
                    v[i+1] = 2;
              }

            }
            else
            {
                if(v[i] == 1)
                {
                    cout<<0;
                    v[i+1] = 0;
                }
                else
                {
                    cout<<1;
                       v[i+1] = 1;
                }

            }
        }

        cout<<endl;
    }

	return 0;
}


