#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

/* SegmentTree(Sum) */
//0-index

struct SegTree{
  typedef int Type;
  int segn2;
  Type inf;
  vector<Type> data,s_data;
  
  SegTree(int n){
    segn2=1;
    while(segn2<n) segn2*=2;
    
    data.assign(segn2*2,0);
    s_data.assign(segn2*2,0);
  }
  
  //get sum of [a,b]
  Type query(int a,int b,int l=0,int r=-1,int k=0){
    Type ret = 0;
    
    if(r==-1) r+=segn2;
    
    if(r<a || b<l) return 0;
    
    if(a<=l && r<=b) return data[k] + s_data[k]*(r-l+1);
    
    ret += (min(r,b)-max(l,a)+1) * s_data[k];
    
    ret += query(a,b,l,(l+r)/2,k*2+1)+query(a,b,(l+r)/2+1,r,k*2+2);
    return ret;
  }
  
  //add x to [a,b]
  Type add(int a,int b,Type x,int l=0,int r=-1,int k=0){
    if(r==-1) r+=segn2;
    
    if(a<=l && r<=b){
      s_data[k]+=x;
    }else if(a<=r && l<=b){
      data[k] = add(a,b,x,l,(l+r)/2,k*2+1) + add(a,b,x,(l+r)/2+1,r,k*2+2);
    }
    
    return data[k] + s_data[k]*(r-l+1);
  }
};



int main(){
  char s[SIZE];
  int n,m;
  int l[SIZE],r[SIZE];
  vector<int> cc[SIZE];
  
  scanf("%s%d",s,&m);
  n = strlen(s);

  for(int i=0;i<m;i++){
    scanf("%d%d",l+i,r+i);
    l[i]--; r[i]--;
    
    if(n%2 == 0){
      if(l[i] <= n/2-1 && n/2 <= r[i]){
        int a = n/2 - l[i];
        int b = r[i] - (n/2 - 1);
        
        if(a == b){
          l[i] = r[i] = -1;
        }else if (a > b){
          l[i] = n/2 - a;
          r[i] = n/2 - b - 1;
        }else{
          l[i] = n/2 - b;
          r[i] = n/2 - a - 1;
        }
      }
    }else{
      if(l[i] == r[i] && l[i] == n/2){
        l[i] = -1; r[i] = -1;
      }else if(l[i] == n/2){
        l[i] += 1;
      }else if(r[i] == n/2){
        r[i] -= 1;
      }else if(l[i] <= n/2-1 && n/2+1 <= r[i]){
        int a = n/2 - l[i];
        int b = r[i] - n/2;

        if(a == b){
          l[i] = r[i] = -1;
        }else if(a > b){
          l[i] = n/2 - a;
          r[i] = n/2 - b - 1;
        }else{
          l[i] = n/2 - b;
          r[i] = n/2 - a - 1;
        }
      }
    }

    if(l[i] != -1){
      if((n+1)/2 <= l[i]){
        l[i] = n - l[i] - 1;
        r[i] = n - r[i] - 1;
        swap(l[i], r[i]);
      }

      assert(l[i] < n/2 && r[i] < n/2);
      cc[l[i]].push_back(r[i]);
    }
  }

  for(int i=0;i<n/2;i++){
    if(cc[i].size() > 1)
      sort(cc[i].begin(),cc[i].end());

    for(int j=cc[i].size()-2;j>=0;j--){
      if(cc[i][j] != cc[i][j+1])
        cc[cc[i][j]+1].push_back(cc[i][j+1]);
    }
  }

  SegTree seg(n);
  
  for(int i=0;i<n/2;i++){
    seg.add(i, i, 26 + s[n-i-1] - s[i]);
  }

  for(int i=0;i<n/2;i++){
    if(cc[i].size()){
      int q = seg.query(i,i);
      seg.add(i, cc[i][0], 26-q%26);
    }

    if(seg.query(i,i)%26 != 0){
      puts("NO");
      return 0;
    }
  }

  puts("YES");
  
  return 0;
}



Measured memory_bytes: 10112