// Original C++ solution (slower):
#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 dforn(i,n) dforsn(i,0,n)

#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

#define endl '\n'

using pii = pair<int,int>;

using vi = vector<int>;

using ll = long long;



const int N = 1e5+2;

int n, dif[N];

vi adj[N];

bool vis[N];



int sum(int u) {

    vis[u] = true;

    int res = dif[u];



    for (int v : adj[u]) if (!vis[v]) res = (res + sum(v)) % 26;



    return res;

}



int main() {

	fastio;

	

    // leo string

    string s; cin >> s; 

    n = si(s); 

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



    // calculo diferencias

    forn(i, n+1) dif[i] = (s[i+1] - s[i] + 26) % 26;



    // agrego arcos

    int k; cin >> k;

    while (k--) {

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

        adj[l].pb(r), adj[r].pb(l);

    }

    forn(i, (n+1)/2) {

        int j = n-i;

        adj[i].pb(j), adj[j].pb(i);

    }



    // controlo suma

    bool can = true;

    forn(u, n+1) if (!vis[u] && sum(u) != 0) can = false;



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

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

#define debug(x) cout << #x << " = " << x << endl

#define pb push_back

#define F first

#define S second



const int MAX = 100005;

int dif[MAX];





struct dsu {

    vector<int> par, sz, sum;

    int size;



    dsu(int n) {

        size = n;

    	par = sz = sum = vector<int>(n);

        for (int i = 0; i < n; i++) {

            par[i] = i;

            sz[i] = 1;

            sum[i] = dif[i];

        }

    }



    int find(int u) {

        return par[u] == u ? u : (par[u] = find(par[u]));

    }



    void unite(int u, int v) {

        if ((u = find(u)) == (v = find(v))) return;

        if (sz[u] > sz[v]) swap(u,v);

        par[u] = v;

        sz[v] += sz[u];

        sum[v] = (sum[v]+sum[u])%26;

        size--;

    }



    int count(int u) {

        return sz[find(u)];

    }



    int getSum(int u){

        return sum[find(u)];

    }

};





int main() {

    #ifdef LOCAL

        freopen("in.txt", "r", stdin);

        //freopen("out.txt", "w", stdout);

    #endif

    ios::sync_with_stdio(0);

    cin.tie(0);



    string s;

    int n, sz, a, b;



    cin >> s >> n;

    sz = s.size();



    for (int i = 0; i < sz; i++){

        dif[i+1] = s[i]-'a';

    }

    for (int i = 0; i < sz+1; i++) {

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

    }



    dsu ds = dsu(sz+1);



    for (int i = 0; i < sz; i++) {

        ds.unite(i, sz-i);

    }



    for (int i = 0; i < n; i++) {

            cin >> a >> b;

            a--;

            ds.unite(a, b);

    }

    bool f = true;

    for (int i = 0; i < sz; i++) {

        if(ds.getSum(i) != 0){

            f = false;

            break;

        }

    }



    if(f)cout << "YES\n";

    else cout << "NO\n";







}


// Fastest known solution for this problem: