#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

template <typename T>
class FenwickTree {
  const int n;
  vector<T> data;
public:
  FenwickTree(int n) : n(n), data(n, 0) {}
  void add(int i, T value) {
    for (; i < n; i |= i + 1) data[i] += value;
  }
  T sum(int i) const {
    T res = 0;
    for (; i >= 0; i = (i & (i + 1)) - 1) res += data[i];
    return res;
  }
  T sum(int l, int r) const { return sum(r - 1) - sum(l - 1); }
};

vector<int> le[100010];
vector<int> ri[100010];

void addq(int l, int r) {
  le[l].push_back(r);
  ri[r].push_back(l);
}

void solve(string S, ll N, vector<ll> L, vector<ll> R) {
  const int n = S.size();
  FenwickTree<int> bit(n + 1);
  REP(i,n) {
    bit.add(i, S[i] - 'a');
    bit.add(i + 1, -(S[i] - 'a'));
  }
  REP(i,N) {
    int l = L[i] - 1, r = R[i] - 1;
    addq(l, r);
  }
  for (int l = 0, r = n - 1; l < r; ++l, --r) {
    // string s; 
    // REP(i,n) {
    //   int d = bit.sum(i);
    //   d = (d % 26 + 26) % 26;
    //   s += char('a' + d);
    // }
    // cout << s << endl;
    vector<int> ch;
    for (int i: le[l])
      if (l <= i && i < r) ch.push_back(i);
    for (int i: ri[r])
      if (l < i && i <= r) ch.push_back(i - 1);

    if (ch.empty()) {
      int d = bit.sum(r) - bit.sum(l);
      if ((d % 26 + 26) % 26 != 0) {
        cout << "NO" << endl;
        return;
      }
      continue;
    }
    else {
      for (int i = 1; i < int(ch.size()); ++i) {
        if (ch[0] < ch[i]) addq(ch[0] + 1, ch[i]);
        if (ch[0] > ch[i]) addq(ch[i] + 1, ch[0]);
      }
      int d = bit.sum(r) - bit.sum(l);
      d = (d % 26 + 26) % 26;
      bit.add(l, d);
      bit.add(ch[0] + 1, -d);
    }
  }
  cout << "YES" << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	string S;
	ll N;
	cin >> S;
	scanf("%lld", &N);
	vector<ll> L(N-1+1);
	vector<ll> R(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &L[i]);
	  scanf("%lld", &R[i]);
	}
	solve(S, N, L, R);
	return 0;
}


Measured memory_bytes: 25140