#include<bits/stdc++.h>
using namespace std;
double yes;
string arr;
string brr;
int tot=0;
int main(){
cin >> yes >> arr >> brr;
for (int i=0;i<arr.size();i++){
if (arr[i]!=brr[i]){
tot++;
}
}
if (tot>=yes*arr.size()){
cout << "no";
return 0;
}
cout << "yes";
return 0;
}