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;

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << (a) << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int N = 1e5 + 10;

int n, val[N];
vi adj[N];
string s;

int mod(int x) {
    while (x < 0) x += 26;
    while (x >= 26) x -= 26;
    return x;
}

bool vis[N];
int dfs(int u) {
    if (vis[u]) return 0;
    vis[u] = 1;
    int ans = val[u];
    for (int v : adj[u]) ans += dfs(v);
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin >> s; n = si(s);
    s = "a" + s + "a";
    forn(i,si(s)-1) val[i] = mod(int(s[i+1])-s[i]);
    for (int i = 0, j = n; i < j; i++, j--) {
        val[i] = mod(val[i] + val[j]);
        val[j] = 0;
    }
    int m; cin >> m;
    while (m--) {
        int l,r; cin >> l >> r; l--;
        int u = min(l,n-l), v = min(r,n-r);
        adj[u].pb(v);
        adj[v].pb(u);
    }

    bool ok = 1;
    forn(u,n+1) if (!vis[u]) ok &= dfs(u)%26 == 0;
    cout << (ok ? "YES" : "NO") << endl;

    return 0;
}