import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto S = readln.chomp.map!(x => to!int(x - 'a')).array;
    auto N = S.length.to!int;
    auto Q = readln.chomp.to!int;
    Tuple!(int, int)[] LR;

    foreach (i; 0..Q) {
        auto s = readln.split.map!(to!int);
        auto l = s[0] - 1;
        auto r = s[1] - 1;
        if (l >= N / 2) {
            l = N - l - 1;
            r = N - r - 1;
            swap(l, r);
        } else if (r >= N / 2) {
            r = N - r - 1;
            if (l == r) continue;
            if (l > r) swap(l, r);
            r -= 1;
        }
        LR ~= tuple(l, r);
    }

    LR.sort!"a[0] < b[0]";
    auto pq = new BinaryHeap!(Array!int, "a > b");
    int p = 0;

    auto st = new SegmentTree!(int, (a,b)=>a+b, 0)(N/2+1);
    foreach (i; 0..N/2) {
        st.assign(i, S[i]-S[N-i-1]);
        st.assign(i+1, -(S[i]-S[N-i-1]));
    }

    foreach (i; 0..N/2) {
        while (p < LR.length && LR[p][0] == i) {
            pq.insert(LR[p][1]);
            ++p;
        }
        if (pq.empty) continue;
        int r = pq.front;
        int v = st.query(0, i);
        st.add(i, -v);
        st.add(r+1, v);
        while (!pq.empty && pq.front == i) {
            pq.removeFront;
        }
    }

    foreach (i; 0..N/2) {
        if (st.query(0, i) % 26 != 0) {
            writeln("NO");
            return;
        }
    }
    writeln("YES");
}


class SegmentTree(T, alias op, T e) {
    T[] table;
    int size;
    int offset;

    this(int n) {
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        fill(table, e);
        offset = size / 2;
    }

    void assign(int pos, T val) {
        pos += offset;
        table[pos] = val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    void add(int pos, T val) {
        pos += offset;
        table[pos] += val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    T query(int l, int r) {
        return query(l, r, 1, 0, offset-1);
    }

    T query(int l, int r, int i, int a, int b) {
        if (b < l || r < a) {
            return e;
        } else if (l <= a && b <= r) {
            return table[i];
        } else {
            return op(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b));
        }
    }
}
