#include <iostream> using namespace std; int main() { int n,test; string s,t; cin >> test; while (test--) { cin >> n >> s >> t; if ( s == t ) cout << 0 << endl; else cout << 1 << endl; } }