#include <bits/stdc++.h>
using namespace std;
int n, a, b;
vector<int> p, q;
vector<pair<int, int> > ans;
bool check() {
  for (int i = 0; i < ((int)(q).size());) {
    int j = i + 1;
    while (j < ((int)(q).size()) && q[j] == q[j - 1] - 1) {
      ++j;
    }
    if (j - i > b) {
      return false;
    }
    if (j < ((int)(q).size()) && q[j] < q[j - 1]) {
      return false;
    }
    i = j;
  }
  return true;
}
void mv(int x) {
  if (!x) return;
  ans.push_back(make_pair(1, x));
  q.insert(q.end(), p.begin() + ((int)(p).size()) - x, p.end());
  p.resize(((int)(p).size()) - x);
}
void fail() {
  puts("NO");
  exit(0);
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; ++i) {
    static int x;
    scanf("%d", &x);
    p.push_back(x);
  }
  reverse(p.begin(), p.end());
  while (!p.empty() || !q.empty()) {
    if (!check()) {
      fail();
    }
    int pos = -1;
    int cur = ((int)(p).size()) + ((int)(q).size());
    for (int i = 0; i < ((int)(q).size()); ++i) {
      if (q[i] == cur) {
        pos = i;
        break;
      }
    }
    if (pos >= 0) {
      ans.push_back(make_pair(2, ((int)(q).size()) - pos));
      q.resize(pos);
    } else {
      for (int i = 0; i < ((int)(p).size()); ++i) {
        if (p[i] == cur) {
          pos = i;
          break;
        }
      }
      bool single = true;
      for (int i = pos + 1; i < ((int)(p).size()); ++i) {
        if (p[i] != p[i - 1] - 1) {
          single = false;
          break;
        }
      }
      if (single) {
        mv(1);
        continue;
      }
      for (pos = ((int)(p).size()) - 1; pos >= 0; --pos) {
        if (pos > 0 && p[pos - 1] > p[pos] + 1) {
          break;
        }
      }
      single = true;
      for (int i = pos + 1; i < ((int)(p).size()); ++i) {
        if (p[i] != p[i - 1] - 1) {
          single = false;
          break;
        }
      }
      if (single) {
        int cnt = ((int)(p).size()) - pos;
        if (cnt <= a) {
          mv(cnt);
        } else {
          while (cnt--) {
            mv(1);
          }
        }
        continue;
      }
      bool continous = *max_element(p.begin() + pos, p.end()) -
                           *min_element(p.begin() + pos, p.end()) + 1 ==
                       ((int)(p).size()) - pos;
      if (!continous) {
        int cnt = ((int)(p).size()) - pos;
        if (cnt <= a) {
          mv(cnt);
        } else {
          fail();
        }
      } else {
        int tot = 0, len = 0, mx = 0;
        for (int i = pos + 1; i < ((int)(p).size()); ++i) {
          if (p[i] != p[i - 1] - 1) {
            ++tot;
            len = 1;
          } else {
            mx = max(mx, ++len);
          }
        }
        if (tot > 1) {
          if (((int)(p).size()) - pos > b || mx > a) {
            int cnt = ((int)(p).size()) - pos;
            if (cnt <= a) {
              mv(cnt);
            } else {
              fail();
            }
          } else {
            for (int i = ((int)(p).size()) - 1, j = i; i >= pos; i = --j) {
              while (j > pos && p[j - 1] == p[j] + 1) {
                --j;
              }
              mv(((int)(p).size()) - j);
            }
          }
        } else {
          assert(tot == 1);
          int len0 = 1, len1 = 1, mid = -1;
          for (int i = ((int)(p).size()) - 1; i >= pos; --i) {
            if (p[i - 1] == p[i] + 1) {
              ++len0;
            } else {
              mid = i;
              break;
            }
          }
          for (int i = mid - 1; i >= pos; --i) {
            if (p[i - 1] == p[i] + 1) {
              ++len1;
            } else {
              assert(i == pos);
              break;
            }
          }
          if (len0 + len1 <= b && len0 <= a && len1 <= a) {
            mv(len0);
            mv(len1);
          } else {
            bool flag = false;
            for (int i = 0; i <= len0 + len1; ++i) {
              int mb, ma;
              if (i <= len0) {
                ma = max(i, len0 + len1 - i);
                mb = max(i + len1, len0 - i);
              } else {
                ma = max(i, len0 + len1 - i);
                mb = max(i - len0, 2 * len0 + len1 - i);
              }
              if (mb <= b && ma <= a) {
                flag = true;
                mv(i);
                mv(len0 + len1 - i);
                break;
              }
            }
            if (!flag) fail();
          }
        }
      }
    }
  }
  puts("YES");
  printf("%d\n", (int)ans.size());
  for (auto x : ans) {
    printf("%d %d\n", x.first, x.second);
  }
  return 0;
}
