#include <bits/stdc++.h>
int pow(int a, int b) {
  int ret = 1, base = a;
  while (b) {
    if (b & 1) ret *= base;
    base *= base;
    b >>= 1;
  }
  return ret;
}
int most, n, d, k;
int all = 1;
int flag = 1;
void dfs1(int u, int dep) {
  if (n == 0) return;
  if (u == 1) {
    for (int i = 1; i <= k && n; i++) {
      if (dep < most) {
        n--;
        all++;
        printf("%d %d\n", u, all);
        dfs1(all, dep + 1);
      } else if (dep == most && flag) {
        flag--;
        n--;
        all++;
        printf("%d %d\n", u, all);
      }
    }
  } else {
    for (int i = 1; i < k && n; i++) {
      if (dep < most) {
        n--;
        all++;
        printf("%d %d\n", u, all);
        dfs1(all, dep + 1);
      } else if (dep == most && flag) {
        flag--;
        n--;
        all++;
        printf("%d %d\n", u, all);
      }
    }
  }
}
void dfs2(int u, int dep) {
  if (n == 0) return;
  if (u == 1) {
    for (int i = 1; i <= k && n; i++) {
      if (dep < most) {
        n--;
        all++;
        printf("%d %d\n", u, all);
        dfs2(all, dep + 1);
      }
    }
  } else {
    for (int i = 1; i < k && n; i++) {
      if (dep < most) {
        n--;
        all++;
        printf("%d %d\n", u, all);
        dfs2(all, dep + 1);
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &d, &k);
  most = d / 2;
  if (d & 1) {
    if (k == 2) {
      if (most * 2 + 2 < n) {
        puts("NO");
        return 0;
      }
    } else if (k * (pow(k - 1, most) - 1) + k < n) {
      puts("NO");
      return 0;
    }
  } else {
    if (k == 2) {
      if (most * 2 + 1 < n) {
        puts("NO");
        return 0;
      }
    } else if (k * (pow(k - 1, most) - 1) + 1 < n) {
      puts("NO");
      return 0;
    }
  }
  flag = k - 1;
  puts("YES");
  if (d & 1) {
    n--;
    dfs1(1, 0);
  } else {
    n--;
    dfs2(1, 0);
  }
}
