Problem: Ringo has a string S.

He can perform the following N kinds of operations any number of times in any order.

* Operation i: For each of the characters from the L_i-th through the R_i-th characters in S, replace it with its succeeding letter in the English alphabet. (That is, replace `a` with `b`, replace `b` with `c` and so on.) For `z`, we assume that its succeeding letter is `a`.



Ringo loves palindromes and wants to turn S into a palindrome. Determine whether this is possible.

Constraints

* 1 \leq |S| \leq 10^5
* S consists of lowercase English letters.
* 1 \leq N \leq 10^5
* 1 \leq L_i \leq R_i \leq |S|

Input

Input is given from Standard Input in the following format:


S
N
L_1 R_1
L_2 R_2
:
L_N R_N


Output

Print `YES` if it is possible to turn S into a palindrome; print `NO` if it is impossible.

Examples

Input

bixzja
2
2 3
3 6


Output

YES


Input

abc
1
2 2


Output

NO


Input

cassert
4
1 2
3 4
1 1
2 2


Output

YES

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string S;
set<int> st[105000];
int N;
struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree() {
        int sz = 100500;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = 0;
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }
    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);

        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }

};


void merge(set<int> &a, set<int> &b) {
    if(a.size() < b.size()) swap(a, b);
    for(auto val : b) {
        a.insert(val);
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S;
    N = S.size();
    int Q;
    cin >> Q;
    while(Q--) {
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        if(r < N / 2) {
            st[l].insert(r);
        } else if(l >= N / 2) {
            st[N - 1 - r].insert(N - 1 - l);
        } else {
            r = N - 1 - r;
            if(r < l) swap(l, r);
            if(l != r) {
                st[l].insert(r - 1);
            }
        }
    }
    /*
    for(int i = 0; i <= N; i++) {
        for(auto val : st[i]) cerr << i << " " << val << endl;
    }
    */
    LazySegmentTree seg;
    for(int i = 0; i < N; i++) {
        seg.add(i, i + 1, S[i] - 'a');
    }
    for(int i = 0; i <= N / 2; i++) {
        while(true) {
            if(seg.getsum(i, i + 1) % 26 == seg.getsum(N - 1 - i, N - i) % 26) break;
            if(st[i].empty()) {
                cout << "NO" << endl;
                return 0;
            }
            auto itr = st[i].begin();
            seg.add(i, *itr + 1, 1);
        }
        if(!st[i].empty()) {
            auto itr = st[i].begin();
            int r = *itr + 1;
            st[i].erase(itr);
            merge(st[r], st[i]);
        }
    }
    cout << "YES" << endl;
    return 0;
}