// 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: 3.3565949635744703x):
#include <bits/stdc++.h>

#define fst first

#define snd second

#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)

#define pb push_back

#define ALL(s) s.begin(),s.end()

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

#define SZ(s) int(s.size())

using namespace std;

typedef long long ll;

typedef pair<int,int> ii;



int vis[100010];

vector<int> g[100010],a;



int get(int pos){

	int v=a[pos]; vis[pos]=1;

	for(auto x:g[pos]) if(!vis[x]) v+=get(x);

	return v%26;

}



int main(){FIN;

	string s; int q; cin>>s>>q;

	s="a"+s+"a";

	fore(i,1,SZ(s)) a.pb((s[i]-s[i-1]+26)%26);

	int n=SZ(a);

	fore(i,0,n) g[i].pb(n-i-1);

	while(q--){

		int l,r;cin>>l>>r;

		g[l-1].pb(r); g[r].pb(l-1);

	}

	fore(i,0,n) if(!vis[i]&&get(i)) cout << "NO\n",exit(0);

	cout<<"YES\n";

}//pingo