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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#define PI                acos(-1)

#define pb                emplace_back

#define mp                make_pair

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

#define clr(a,h)          memset(a, (h), sizeof(a))

#define F first

#define S second



using namespace std;

using namespace __gnu_pbds;



typedef long long       ll;

typedef pair<ll, ll>  ii;

typedef vector<ll>     vi;

typedef vector<ii>      vii;

typedef vector<ll>      vll;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const ll INF = ll(1e9 + 7);



const ll tam = 100010;



vector<ll> G[tam];

ll val[tam];

bool vis[tam];



ll sum;

void dfs(ll v)

{

	//cout << "(" << v << "," << val[v] << ") ";

	sum += (val[v] + 26);

	sum %= 26;

	vis[v] = true;

	for (ll u : G[v])

	{

		if ( vis[u] ) continue;

		dfs(u);

	}

}



ii E[tam];



int main()

{

    std::ios::sync_with_stdio(false); cin.tie(0);

    //freopen("","r",stdin);

    //freopen("","w",stdout);

    string s;

    cin >> s;

    ll n;

    cin >> n;

    for (ll i = 0; i < n; i++)

    {

    	cin >> E[i].F >> E[i].S;

    }

    if (s.size() == 1)

    {

    	cout << "YES" << '\n';

    	return 0;

    }

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



    //cout << s << endl;

	for (ll i = 0; i < s.size()-1; i++)

    {

    	val[i] = (s[i+1] - s[i] + 26) % 26;

    	//cout << "(" << val[i] << "[" << i << "," << i+1 << "]) ";

    }

    //cout << endl;



    for (ll i = 0; i < n; i++)

    {

    	//val[ E[i].F-1 ] = (val[ E[i].F-1 ] + 1) % 26;

    	//val[ E[i].S ] = (val[ E[i].S ] - 1 + 26) % 26;

    	G[E[i].F-1].pb( E[i].S );

    	G[ E[i].S ].pb(E[i].F-1);

    }

    /*

    for (ll i = 0; i < s.size()-1; i++)

    {

    	cout << "(" << val[i] << "[" << i << "," << i+1 << "]) ";

    }

    cout << endl;

    */

    for (ll i = 0; i < s.size()-1; i++)

    {

    	G[i].pb( s.size()-2-i );

    }

    clr(vis, false);

    bool poss = true;

    for (ll i = 0; i < s.size()-1; i++)

    {

    	if (vis[i]) continue;

    	//cout << "component: " << endl;

    	sum = 0;

    	dfs(i);

    	//cout << endl << "===============" << endl;

    	if (sum != 0) poss = false;

    }

    if (poss) cout << "YES" << '\n';

    else cout << "NO" << '\n';

    return 0;

}

// PLUS ULTRA!!!!

// Faster C++ solution for the same problem (measured speedup: 3.5663959076449125x):
#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;

}