#include<bits/stdc++.h>
#include<chrono>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
auto start = chrono::steady_clock::now();
void init_code(){
fast_io;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
bool equal(string s,string ss){
for(int i=0;i<s.length();i++){
if(s[i]!=ss[i]) return false;
}
return true;
}
int main(){
init_code();
int t;
cin>>t;
while(t--){
string s,t;
int n;
cin>>n;
cin>>s>>t;
if(equal(s,t)) cout<<0<<endl;
else cout<<1<<endl;
}
return 0;
}
Copy