#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 9;
int n, a, b, vl[2222], vis[2222], times, vm[2222], cnt, gp[2222], cs;
int ans_list[2][110000], num_ans, m, pos[2222];
bool go(int left, int right) {
  int i, j, s, p, q, lm = inf, rm = -inf, id, ip;
  bool mv = true;
  while (mv) {
    mv = false;
    for (i = left; i <= right; i++) {
      if (vl[i] == m) break;
    }
    if (i <= right) {
      mv = true;
      if (i > left) {
        for (j = left; j <= i; j++) {
          ans_list[0][num_ans] = 1;
          ans_list[1][num_ans++] = 1;
        }
        for (j = left; j <= i; j++) {
          ans_list[0][num_ans] = 2;
          ans_list[1][num_ans++] = 1;
        }
        m -= i - left + 1;
        left = i + 1;
      } else {
        ans_list[0][num_ans] = 1;
        ans_list[1][num_ans++] = 1;
        ans_list[0][num_ans] = 2;
        ans_list[1][num_ans++] = 1;
        m--;
        left++;
      }
    }
    for (i = cnt - 1; i >= 0; i--) {
      if (vm[i] == m) break;
    }
    if (i >= 0) {
      mv = true;
      for (j = i; j < cnt; j++) {
        if (vm[j] + j != vm[i] + i) return false;
      }
      if (cnt - i > b) return false;
      ans_list[0][num_ans] = 2;
      ans_list[1][num_ans++] = cnt - i;
      m -= cnt - i;
      cnt = i;
    }
  }
  if (left > right) return true;
  cs = 0;
  for (i = left; i <= right;) {
    for (j = i; j <= right; j++) {
      if (vl[j] - j != vl[i] - i) break;
    }
    if (j == i + 1) {
      for (j = i; j <= right; j++) {
        if (vl[j] + j != vl[i] + i) break;
      }
    }
    gp[cs++] = j - 1;
    i = j;
  }
  times++;
  for (i = left; i <= right; i++) {
    if (lm > vl[i]) lm = vl[i];
    if (rm < vl[i]) rm = vl[i];
    vis[vl[i]] = times;
  }
  bool con = true;
  for (i = lm; i <= rm; i++) {
    if (vis[i] != times) con = false;
  }
  times++;
  for (i = 0; i < cnt; i++) vis[vm[i]] = times;
  if (!con) {
    if (right - left + 1 > a || (cnt > 0 && vl[right] < vm[cnt - 1] - 1))
      return false;
    ans_list[0][num_ans] = 1;
    ans_list[1][num_ans++] = right - left + 1;
    for (i = right; i >= left; i--) vm[cnt++] = vl[i];
    return true;
  }
  int pre = left;
  for (i = 0; i < cs; i++) {
    bool ok = false;
    if (right - pre + 1 <= a && cs - i > 1 &&
        (cnt == 0 || vl[right] >= vm[cnt - 1] - 1)) {
      ok = true;
      if (cs == 2 && i == 0) {
        if (pre == gp[i] || vl[pre] < vl[pre + 1]) {
          if (gp[i + 1] - gp[i] == 1 || vl[gp[i + 1] - 1] < vl[gp[i + 1]])
            ok = false;
        }
      }
      if (right - left + 1 <= b) ok = false;
      if (ok) {
        ans_list[0][num_ans] = 1;
        ans_list[1][num_ans++] = right - pre + 1;
        for (j = right; j >= pre; j--) {
          vis[vl[j]] = times;
          vm[cnt++] = vl[j];
        }
        break;
      }
    }
    if (cs - i != 2 || cs != 2) {
      bool ok = false;
      if (pre != gp[i]) {
        if (vl[pre] > vl[pre + 1]) ok = true;
      }
      if (!ok &&
          (gp[i] - pre + 1 > a || (cnt > 0 && vl[gp[i]] < vm[cnt - 1] - 1)))
        ok = true;
      if (ok && (gp[i] - pre + 1 > b || (cnt > 0 && vl[pre] < vm[cnt - 1] - 1)))
        ok = false;
      if (!ok) {
        if (gp[i] - pre + 1 > a || (cnt > 0 && vl[gp[i]] < vm[cnt - 1] - 1))
          return false;
        ans_list[0][num_ans] = 1;
        ans_list[1][num_ans++] = gp[i] - pre + 1;
        for (j = gp[i]; j >= pre; j--) {
          vm[cnt++] = vl[j];
          vis[vl[j]] = times;
        }
      } else {
        if (gp[i] - pre + 1 > b || (cnt > 0 && vl[pre] < vm[cnt - 1] - 1))
          return false;
        for (j = pre; j <= gp[i]; j++) {
          ans_list[0][num_ans] = 1;
          ans_list[1][num_ans++] = 1;
          vm[cnt++] = vl[j];
          vis[vl[j]] = times;
        }
      }
    } else {
      if ((gp[i] - pre >= 1 && vl[pre] > vl[pre + 1])) {
        if (cnt > 0 && vl[pre] < vm[cnt - 1] - 1) return false;
        for (j = pre; j <= gp[i]; j++) {
          ans_list[0][num_ans] = 1;
          ans_list[1][num_ans++] = 1;
          vm[cnt++] = vl[j];
          vis[vl[j]] = times;
        }
      } else {
        bool ok = false;
        if (gp[i] - pre + 1 <= a && gp[i + 1] - gp[i] <= a &&
            right - left + 1 <= b)
          ok = true;
        if ((gp[i + 1] - gp[i] >= 2 && vl[gp[i + 1] - 1] > vl[gp[i + 1]]) ||
            ok) {
          if (gp[i] - pre + 1 > a || (cnt > 0 && vl[gp[i]] < vm[cnt - 1] - 1))
            return false;
          ans_list[0][num_ans] = 1;
          ans_list[1][num_ans++] = gp[i] - pre + 1;
          for (j = gp[i]; j >= pre; j--) {
            vis[vl[j]] = times;
            vm[cnt++] = vl[j];
          }
        } else {
          for (j = max(right - a, gp[i] + 1); j <= min(right, pre + a - 1);
               j++) {
            int x;
            if (j <= gp[i])
              x = max(gp[i] - j, j - pre + 1 + gp[i + 1] - gp[i]);
            else
              x = max(j - gp[i], right - j + gp[i] - pre + 1);
            if (x <= b && (cnt == 0 || vl[j] >= vm[cnt - 1] - 1)) break;
          }
          if (j > min(right, pre + a - 1)) {
            for (j = min(min(right, pre + a - 1),
                         max(right - a, gp[i] + 1) - 1);
                 j >= max(pre, right - a); j--) {
              int x;
              if (j <= gp[i])
                x = max(gp[i] - j, j - pre + 1 + gp[i + 1] - gp[i]);
              else
                x = max(j - gp[i], right - j + gp[i] - pre + 1);
              if (x <= b && (cnt == 0 || vl[j] >= vm[cnt - 1] - 1)) break;
            }
            if (j < max(pre, right - a)) return false;
          }
          ans_list[0][num_ans] = 1;
          ans_list[1][num_ans++] = j - pre + 1;
          if (j < right) {
            ans_list[0][num_ans] = 1;
            ans_list[1][num_ans++] = right - j;
          }
          for (s = j; s >= pre; s--) {
            vis[vl[s]] = times;
            vm[cnt++] = vl[s];
          }
          for (s = right; s > j; s--) {
            vis[vl[s]] = times;
            vm[cnt++] = vl[s];
          }
          break;
        }
      }
    }
    pre = gp[i] + 1;
  }
  return true;
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  m = n;
  int i, j, s, p, q, pre;
  for (i = 0; i < n; i++) scanf("%d", &vl[i]);
  pre = 0;
  cnt = 0;
  for (i = 0; i < n; i++) {
    if (i == n - 1 || vl[i] < vl[i + 1] - 1) {
      if (!go(pre, i)) {
        puts("NO");
        return 0;
      }
      pre = i + 1;
    }
  }
  for (i = cnt - 1; i >= 0;) {
    for (j = i; j >= 0; j--) {
      if (vm[i] + i != vm[j] + j) break;
    }
    if (i - j > b || vm[j + 1] != m) {
      puts("NO");
      return 0;
    }
    m -= i - j;
    ans_list[0][num_ans] = 2;
    ans_list[1][num_ans++] = i - j;
    i = j;
  }
  puts("YES");
  printf("%d\n", num_ans);
  for (i = 0; i < num_ans; i++)
    printf("%d %d\n", ans_list[0][i], ans_list[1][i]);
  return 0;
}
