#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;
}