// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long Long;



const Long N = 1e5 + 10;



set<Long> ini[N];

set<Long> fin[N];



Long tree1[N];

Long tree2[N];



Long query1(Long i){

	Long sum=0;

	while(i>0){

		sum+=tree1[i];

		i-=(i&-i);

	}

	return sum;

}

Long query2(Long i){

	Long sum=0;

	while(i>0){

		sum+=tree2[i];

		i-=(i&-i);

	}

	return sum;

}



void update1(Long i, Long val){

	while(i<N){

		tree1[i]+=val;

		i+=(i&-i);

	}

	return;

}

void update2(Long i, Long val){

	while(i<N){

		tree2[i]+=val;

		i+=(i&-i);

	}

	return;

}



Long query(Long x){

	return query1(x)*x-query2(x);

}



void update(Long i, Long j, Long v){

	update1(i,v);

	update1(j+1,-v);

	update2(i,v*(i-1));

	update2(j+1,-j*v);

	return;

}



pair<Long,Long> cambia(Long l, Long r, Long n){

	pair<Long, Long> a,b;

	a = {l,r};

	b = {n-r-1,n-l-1};

	a = min(a,b);

	if(a.second >= n/2){

		Long aux = min(n/2 - 1,n-a.second-2);

		a = {a.first,aux};

	}

	return a;

}



int main(){

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	cout.tie(NULL);

	cout.precision(10);

	cout << fixed;

	

	Long m, l, r, n;

	string cad;

	cin >> cad >> m;

	n = cad.size();

	for(Long i = 0; i < m; i++){

		cin >> l >> r;

		l--;

		r--;

		if(l+r == n-1) continue;

		pair<Long,Long> nuevo = cambia(l,r,n);

		ini[nuevo.first].insert(nuevo.second);

	}

	

	for(Long i = 0; i < n/2; i++){

		Long sz = ini[i].size();

		auto it = ini[i].begin();

		if(sz == 1){

			fin[*it].insert(i);

		}else if(sz > 1){

			Long ant = i;

			while(it != ini[i].end()){

				if(ant != i){

					ini[ant].insert(*it);

				}

				fin[*it].insert(ant);

				ant = *it + 1;

				it++;

			}

		}

	}

	

	vector< pair<Long,Long> > rangos;

	

	for(Long i = 0; i < n/2; i++){

		Long sz = fin[i].size();

		auto it = fin[i].begin();

		if(sz == 1){

			rangos.push_back({*it,i});

		}else if(sz > 1){

			Long ant = *it;

			while(it != fin[i].end()){

				it++;

				if(it == fin[i].end()){

					rangos.push_back({ant,i});

				}else{

					rangos.push_back({ant,*it-1});

					ant = *it;

				}

			}

		}

	}

	

	sort(rangos.begin(),rangos.end());

	

	for(Long i = 0; i < rangos.size(); i++){

		l = rangos[i].first + 1;

		r = rangos[i].second + 1;

		Long auxi = (cad[n-l] - 'a') - (query(l) - query(l-1) + (cad[l-1] - 'a'));

		auxi %= 26;

		auxi += 26;

		auxi %= 26;

		update(l,r,auxi);

	}

	

	for(Long i = 0; i < n/2; i++){

		Long aux = query(i+1) - query(i);

		if(((cad[i] - 'a') + aux)%26 != (cad[n-i-1] - 'a')){

			cout << "NO\n";

			return 0;

		}

	}

//asd

	cout << "YES\n";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 11.650210675874284x):
#include <bits/stdc++.h>

using namespace std;



#ifdef LOCAL

	#define D(a) cerr << #a << " = " << a << endl

#else

	#define D(a)

	#define cerr false && cerr

#endif

#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)

#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)

#define forn(i,n) forsn(i,0,n)

#define all(a) a.begin(),a.end()

#define si(a) int((a).size())

#define pb emplace_back

#define mp make_pair

#define snd second

#define fst first

using pii = pair<int,int>;

using vi = vector<int>;

using ll = long long;



vi node;

vector<vi> g;

vector<bool> v;



int sum(int n){

    v[n] = true;

    int s = node[n];

    for(int i : g[n]) if(!v[i]) s += sum(i);

    return s;

}



int main() {

	fastio;

	

    string s; cin >> s;

    int n = si(s), sd = n+1, sn = (sd+1)/2;

    vi d(sd);

    s = 'a'+s+'a';

    node = vi(sn), g.resize(sn), v.resize(sn);



    forn(i,sd) d[i] = (26+s[i]-s[i+1]) % 26;

    forn(i,sd/2) node[i] = (52-d[i]-d[sd-i-1]) % 26; 

    if(sd & 1) node[sd/2] = (26-d[sd/2]) % 26;



    int m; cin >> m;

    forn(i,m){

        int x,y; cin >> x >> y; x--;

        if(x >= sd/2) x = sd-x-1;

        if(y >= sd/2) y = sd-y-1;

        g[x].pb(y), g[y].pb(x);

    }

    bool ok = true;

    forn(i,sn) if(!v[i] && sum(i) % 26 != 0) ok = false;

    cout << (ok ? "YES" : "NO") << endl;  

	return 0;

}