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<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

set<int> st[1 << 17];
int c[1 << 17];

string s;
void solve() {
	cin >> s;
	int n; n = s.length();
	int dle = n / 2 - 1, dri = (n + 1) / 2;
	int d = n / 2;
	int q; cin >> q;
	rep(i, q) {
		int l, r; cin >> l >> r; l--; r--;
		if (n % 2 && d == l)l++;
		else if (n % 2 && d == r)r--;
		if (l > r)continue;
		if (l <= dle&&dri <= r) {
			int le = dle - l;
			int ri = r - dri;
			int ma = max(le, ri);
			int mi = min(le, ri);
			if (dle - ma <= dle - mi - 1) {
				st[dle - ma].insert(dle - mi -1);
			}
		}
		else if (l >= dri) {
			int le = l - dri, ri = r - dri;
			st[dle - ri].insert(dle - le);
		}
		else {
			st[l].insert(r);
		}
	}
	int cur = 0;
	rep(i, d) {
		//cout << i << endl;
		cur += c[i]; cur = (cur % 26 + 26) % 26;
		//cout << c[i] << endl;
		int dif = s[n - 1 - i] - s[i];
		if (dif < 0)dif += 26;
		//cout << dif << endl;
		if (st[i].empty()) {
			if (dif != cur) {
				cout << "NO" << endl; return;
			}
			continue;
		}
		int ad = dif - cur;
		if (ad < 0)ad += 26;
		int memo = -1;
		for (auto itr = st[i].begin(); itr != st[i].end(); itr++) {
			int z = *itr;
			if (memo < 0) {
				cur += ad; if (cur >= 26)cur -= 26;
				c[z + 1] -= ad;
				//cout << z << endl;
				memo = z;
			}
			else {
				st[memo + 1].insert(z);
				memo = z;
			}
		}
	}
	cout << "YES" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}