#include <bits/stdc++.h>
using namespace std;
const int N = 4010;
int n, a, b;
vector<pair<int, int>> ans;
deque<int> s[3];
inline void print() {
  if (n == 1248)
    for (pair<int, int> p : ans) printf("%d %d\n", p.first, p.second);
}
inline void move(int tp, int c) {
  if (!c) return;
  if (tp == 0 && c > a) print(), puts("NO"), exit(0);
  if (tp == 1 && c > b) print(), puts("NO"), exit(0);
  if (c > s[tp].size()) print(), puts("NO"), exit(0);
  if (c + s[tp + 1].size() > n) print(), puts("NO"), exit(0);
  ans.push_back(make_pair(tp + 1, c));
  for (int i = c - 1; i >= 0; --i) s[tp + 1].push_front(s[tp][i]);
  for (int i = c - 1; i >= 0; --i) s[tp].pop_front();
}
inline bool judge(int tp, int c) {
  if (tp == 0 && c > a) return false;
  if (tp == 1 && c > b) return false;
  return true;
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1, x; i <= n; ++i) scanf("%d", &x), s[0].push_back(x);
  while (s[2].size() != n) {
    if (!s[0].size() && !s[1].size()) print(), puts("NO"), exit(0);
    for (int i = 1; i < s[1].size(); ++i)
      if (s[1][i - 1] < s[1][i] - 1) print(), puts("NO"), exit(0);
    int flag = 0;
    for (int i = 0; i < s[0].size(); ++i) {
      if (s[0][i] == (n - s[2].size())) {
        for (int j = 0; j <= i; ++j) move(0, 1);
        flag = 1;
      }
      if (i < s[0].size() && s[0][i] + 1 < s[0][i + 1]) break;
    }
    if (flag) continue;
    for (int i = 0; i < s[1].size(); ++i) {
      if (s[1][i] == (n - s[2].size())) {
        move(1, i + 1);
        flag = 1;
      }
    }
    if (flag) continue;
    int l = 0, cnt = 1, r = s[0].size() - 1;
    vector<int> st;
    st.push_back(l);
    for (int i = 1; i < s[0].size(); ++i) {
      if (s[0][i - 1] + 1 < s[0][i]) {
        r = i - 1;
        break;
      }
      if (s[0][i] < s[0][i - 1]) ++cnt, st.push_back(i);
    }
    int mn = s[0][0], mx = s[0][0];
    for (int i = l; i <= r; ++i) mn = min(mn, s[0][i]), mx = max(mx, s[0][i]);
    if (mx - mn + 1 > r - l + 1)
      move(0, r - l + 1);
    else {
      int mxlen = 0;
      for (int i = 0; i < st.size(); ++i)
        mxlen = max(mxlen, (i < st.size() - 1 ? st[i + 1] : r + 1) - st[i]);
      if (mxlen <= a && r - l + 1 <= b) {
        for (int i = 0; i < st.size(); ++i)
          move(0, (i < st.size() - 1 ? st[i + 1] : r + 1) - st[i]);
      } else {
        if (r - l + 1 > b) {
          if (cnt == 1)
            for (int i = 1; i <= r - l + 1; ++i) move(0, 1);
          else if (cnt > 2)
            move(0, r - l + 1);
          else {
            for (int i = l; i <= r; ++i) {
              if (judge(0, i - l + 1) && judge(0, r - i)) {
                if (i == st[1] - 1) continue;
                if (i != r) {
                  if (i < st[1] - 1 &&
                      max(st[1] - i, r - l + 1 - (st[1] - i)) > b)
                    continue;
                  if (i >= st[1] &&
                      max(i - st[1] + 1, r - l + 1 - (i - st[1] + 1)) > b)
                    continue;
                }
                if (i == r) {
                  if (mxlen > a) continue;
                }
                move(0, i - l + 1);
                move(0, r - i);
                flag = 1;
                break;
              }
            }
            if (!flag) print(), puts("NO"), exit(0);
          }
        } else {
          if (cnt == 1)
            for (int i = 1; i <= r - l + 1; ++i) move(0, 1);
          else if (cnt > 2)
            print(), puts("NO"), exit(0);
          else {
            for (int i = l; i <= r; ++i) {
              if (judge(0, i - l + 1) && judge(0, r - i)) {
                move(0, i - l + 1);
                move(0, r - i);
                flag = 1;
                break;
              }
            }
            if (!flag) print(), puts("NO"), exit(0);
          }
        }
      }
    }
  }
  puts("YES");
  printf("%d\n", ans.size());
  for (pair<int, int> p : ans) printf("%d %d\n", p.first, p.second);
  return 0;
}
