#include <bits/stdc++.h>

typedef long long ll;

const ll INF = 1e18;

const ll N = 120000;
const ll MOD = 1e9 + 239;

using namespace std;

string s;
int n, l[N], r[N];

int main()
{
    cin >> s;
    if (s.size() == 1)
    {
        cout << "YES";
        return 0;
    }
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> l[i] >> r[i];
        l[i]--, r[i]--;
    }
    if (s.size() % 2 == 1)
    {
        int pos = s.size() / 2;
        for (int i = 0; i < n; i++)
        {
            if (l[i] == pos && r[i] == pos)
            {
                n--;
                swap(l[i], l[n]);
                swap(r[i], r[n]);
                i--;
                continue;
            }
            if (l[i] > pos) l[i]--;
            if (r[i] >= pos) r[i]--;
        }
        string t = "";
        for (int i = 0; i < s.size(); i++) if (i != pos) t += s[i];
        s = t;
    }
    int len = s.size() / 2;
    for (int i = 0; i < n; i++)
    {
        if (l[i] < len && r[i] >= len)
        {
            int p1 = len - l[i], p2 = r[i] - len + 1;
            if (p1 == p2) l[i] = -1, r[i] = -1;
            if (p1 < p2)
            {
                l[i] += 2 * p1;
            }
            if (p1 > p2)
            {
                r[i] -= 2 * p2;
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (l[i] >= len)
        {
            int rr = s.size() - 1 - l[i];
            int ll = s.size() - 1 - r[i];
            l[i] = ll, r[i] = rr;
        }
    }
    string a = "", b = "";
    for (int i = 0; i < len; i++) a += s[i];
    for (int i = len; i < s.size(); i++) b += s[i];
    reverse(b.begin(), b.end());
    vector<int> x(len + 2);
    for (int i = 0; i < len; i++)
    {
        x[i + 1] = (b[i] + 26 - a[i]) % 26;
    }
    //for (int i = 0; i <= len; i++)
    //{
    //    cout << x[i] << " ";
    //}
    //cout << endl;
    for (int i = len + 1; i > 0; i--)
    {
        x[i] = (x[i] - x[i - 1] + 26) % 26;
    }
    for (int i = 0; i < n; i++)
    {
        l[i]++, r[i]++, r[i]++;
    }
    //for (int i = 0; i < x.size(); i++) cout << x[i] << " "; cout << "\n";
    //for (int i = 0; i < n; i++) cout << l[i] << " " << r[i] << "\n";
    vector<int> root(len + 2), sz(len + 2);
    iota(root.begin(), root.end(), 0);
    fill(sz.begin(), sz.end(), 1);
    for (int i = 0; i < n; i++)
    {
        int a = l[i], b = r[i];
        while (a != root[a]) a = root[a];
        while (b != root[b]) b = root[b];
        if (a == b) continue;
        if (sz[a] < sz[b])
        {
            sz[b] += sz[a];
            root[a] = b;
        }
        else
        {
            sz[a] += sz[b];
            root[b] = a;
        }
    }
    vector<int> summ(len + 2);
    for (int i = 1; i < x.size(); i++)
    {
        int j = i;
        while (j != root[j]) j = root[j];
        summ[j] += x[i];
    }
    int t = -1;
    for (int i = 0; i <= len; i++)
    {
        if (summ[i] % 26 != 0)
        {
            if (t == -1) t = i;
            else cout << "NO", exit(0);
        }
    }
    if (t == -1) cout << "YES", exit(0);
    int s = 0;
    while (s != root[s]) s = root[s];
    if (s == t) cout << "YES", exit(0);
    else cout << "NO", exit(0);
}


Measured memory_bytes: 2176