#define taskname "test"

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 1e5 + 5;
int n, m;
string s;
int a[maxn];

vector<int> g[maxn];
bool vis[maxn];

void read_input()
{
    cin >> s;
    n = s.length() + 1;
    s = "a" + s + "a";
    cin >> m;
    for(int i = 0; i < m; ++i)
    {
        int l, r;
        cin >> l >> r;
        --l;
        g[l].push_back(r);
        g[r].push_back(l);
    }
}

void init()
{
    for(int i = 0; i < n; ++i)
        a[i] = s[i + 1] - s[i];
    for(int i = 0; i < n; ++i)
        g[i].push_back(n - i - 1);
}

void dfs(int u, int&tot)
{
    vis[u] = true;
    tot += a[u];
    for(int v: g[u])
        if(!vis[v]) dfs(v, tot);
}

void solve()
{
    fill(begin(vis), end(vis), false);
    for(int i = 0; i < n; ++i)
        if(!vis[i])
        {
            int tot = 0;
            dfs(i, tot);
            tot = (tot % 26 + 26) % 26;
            if(tot != 0)
            {
                cout << "NO\n";
                return;
            }
        }
    cout << "YES\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    init();
    solve();
}
