// بسم الله الرحمن الرحيم  
//متنساش تصل على النبي -صلى الله عليه وسلم- بس كده



// ===================== CORE =====================
    #include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>

    using namespace std;
    using namespace __gnu_pbds;

// ===================== FAST IO / DEBUG ===================== 
    #ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << " = " << x << '\n';
    #define iosystem freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
    #else
    #define debug(x)
    #define iosystem
    #endif

    #define fastio ios::sync_with_stdio(false); cin.tie(nullptr);

// ===================== OPTIMIZATION =====================
    #pragma GCC optimize("O3,unroll-loops")
    #pragma GCC target("avx2,popcnt")

// ===================== TYPES =====================
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pii = pair<int,int>;
    using vpii = vector<pii>;

// ===================== CONSTANTS =====================
    const ll mod = 1e9 + 7;
    const ll INF = LLONG_MAX;
    const double PI = acos(-1.0);

// ===================== CUSTOM HASH =====================
    struct custom_hash {
        static uint64_t splitmix64(uint64_t x){
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }

        size_t operator()(uint64_t x) const {
            static const uint64_t FIXED_RANDOM =
                chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }

        template<class T, class U>
        size_t operator()(const pair<T,U>& p) const {
            static const uint64_t FIXED_RANDOM =
                chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(hash<T>{}(p.first) + FIXED_RANDOM)
                ^ (splitmix64(hash<U>{}(p.second) + FIXED_RANDOM) << 1);
        }
    };

// ===================== PBDS =====================
    template<class T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

    template<class T>
    using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

    // order_of_key, find_by_order

    template<class T>
    void safe_erase(ordered_multiset<T>& s, const T& val){
        int idx = s.order_of_key(val);
        auto it = s.find_by_order(idx);
        if(it != s.end() && *it == val) s.erase(it);
    }

// ===================== LOGIC HELPERS =====================
    //
    
//


#define int long long
// order_of_key, find_by_order
// ===================== SOLVE =====================
    bool multicases = false;

void solve(){
    
    
    int n;cin>>n;
    string a;cin>>a;
    string b;cin>>b;
    
    int idx=-1;
    for(int i = 0 ; i < n ; i++){
        if(a[i]<=b[i]){
            idx=i;
            break;
        }
    }
    
    if(idx==-1) idx=0;//if all are larger
    
    bool found=false;
    
    for(int i = 0 ; i < n; i ++){
        if(i==idx) continue;
        swap(a[i],a[idx]);
        swap(b[i],b[idx]);
        
        if(a>b){
            cout<<"YES\n"<<min(idx,i)+1<<' '<<max(idx,i)+1;//1-indexed
            found=true;
            break;
        }
        
        swap(a[i],a[idx]);
        swap(b[i],b[idx]);
    }
    
    if(!found) cout<<"NO\n";
    
    
}
// order_of_key, find_by_order


// ===================== MAIN =====================
signed main(){
    cin.exceptions(cin.failbit);
    //if wrong in thing which usually fails silently it makes rutime error 
    //instead of wrong answer to know that problem may be not in the logic
    
    fastio;
    iosystem;//<<<<<<<<<<<
    
    int T = 1;
    if(multicases) cin >> T;
    
    while(T--) solve();
    
    return 0;
}