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 LazySegmentTree!(int, int, (a,b)=>a+b, (a,b)=>a+b, (a,b)=>a+b, (a,b)=>a*b, 0L, 0L)(N+1);
    foreach (i; 0..N/2) {
        st.update(i, i, 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.update(i, r, -v);
        while (!pq.empty && pq.front == i) {
            pq.removeFront;
        }
    }

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


class LazySegmentTree(T, L, alias opTT, alias opTL, alias opLL, alias opPrd, T eT, L eL) {
    T[] table;
    L[] lazy_;
    int n;
    int size;

    this(int n) {
        this.n = n;
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        lazy_ = new L[](size);
        table[] = eT;
        lazy_[] = eL;
    }

    void push(int i, int a, int b) {
        if (lazy_[i] == eL) return;
        table[i] = opTL(table[i], opPrd(lazy_[i], b - a + 1));
        if (i * 2 + 1 < size) {
            lazy_[i*2] = opLL(lazy_[i*2], lazy_[i]);
            lazy_[i*2+1] = opLL(lazy_[i*2+1], lazy_[i]);
        }
        lazy_[i] = eL;
    }

    T query(int l, int r) {
        if (l > r) return eT;
        return query(l, r, 1, 0, n-1);
    }

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

    void update(int l, int r, L val) {
        if (l > r) return;
        update(l, r, 1, 0, n-1, val);
    }

    void update(int l, int r, int i, int a, int b, L val) {
        if (b < l || r < a) {
            push(i, a, b);
        } else if (l <= a && b <= r) {
            lazy_[i] = opLL(lazy_[i], val);
            push(i, a, b);
        } else {
            push(i, a, b);
            update(l, r, i*2, a, (a+b)/2, val);
            update(l, r, i*2+1, (a+b)/2+1, b, val);
            table[i] = opTT(table[i*2], table[i*2+1]);
        }
    }
}
