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>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int val[MAX_N];

class UF {
private:
    int sz;
public:
    vector<int> kind;   //所属しているグループ番号
    vector<vector<int> > inc;   //グループのメンバー
    UF(){}
    UF(int node_size){ sz = node_size; kind.resize(sz),inc.resize(sz); rep(i,sz){ kind[i] = i; inc[i].pb(i); } }
    bool same(int a,int b){ return kind[a] == kind[b]; }
    void unite(int a,int b)
    { if(same(a,b)) return; if(inc[kind[a]].size() < inc[kind[b]].size()) swap(a,b);
        int ga = kind[a],gb = kind[b]; rep(i,inc[gb].size()) kind[inc[gb][i]] = ga;
        inc[ga].insert(inc[ga].end(),inc[gb].begin(),inc[gb].end()); inc[gb].clear(); }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = len(s);
    vi vec(n+1);
    rep(i,n+1){
        if(i == 0){
            vec[i] = (s[i]-'a')%26;
        }else if(i == n){
            vec[i] = (26-(s[i-1]-'a'))%26;
        }else{
            vec[i] = ((s[i]-'a')+26-(s[i-1]-'a'))%26;
        }
    }
    int q;
    cin >> q;
    UF uf(n+1);
    rep(i,q){
        int l,r;
        cin >> l >> r;
        uf.unite(l-1,r);
    }
    rep(i,n+1){
        uf.unite(i,n-i);
    }
    rep(i,n+1){
        int val = 0;
        if(len(uf.inc[i])){
            rep(j,len(uf.inc[i])){
                val += vec[uf.inc[i][j]];
            }
        }
        if(val % 26){
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
    return 0;
}