#include <bits/stdc++.h>
using namespace std;
int n, m1, m2, t, dp[2][2000102], s[2000102], tot, a[2000102], b[2000102],
    su[2000102][2];
int pre[2][2000102][2], ts[2000102], ans[2000102][2], cn;
bool vis[2][2000102];
int main() {
  scanf("%d%d%d%d", &n, &m1, &m2, &t);
  for (int i = 1; i <= m1; i++) {
    scanf("%d", &a[i]);
    s[++tot] = a[i];
    if (a[i] < n) s[++tot] = a[i] + 1;
  }
  for (int i = 1; i <= m2; i++) {
    scanf("%d", &b[i]);
    s[++tot] = b[i];
    if (b[i] < n) s[++tot] = b[i] + 1;
  }
  sort(s + 1, s + 1 + tot);
  tot = unique(s + 1, s + 1 + tot) - s - 1;
  for (int i = 1; i <= m1; i++) {
    int x = lower_bound(s + 1, s + 1 + tot, a[i]) - s;
    vis[0][x] = 1;
  }
  for (int i = 1; i <= m2; i++) {
    int x = lower_bound(s + 1, s + 1 + tot, b[i]) - s;
    vis[1][x] = 1;
  }
  for (int i = 1; i <= tot; i++) {
    su[i][0] = su[i - 1][0] + vis[0][i];
    su[i][1] = su[i - 1][1] + vis[1][i];
  }
  for (int i = 1; i <= tot; i++) dp[0][i] = dp[1][i] = -2e9;
  dp[0][0] = dp[1][0] = 0;
  for (int i = 1; i <= tot; i++) {
    if (vis[0][i]) {
      if (dp[0][i - 1] + s[i] - s[i - 1] - 1 >= t) {
        int va = dp[0][i - 1] + s[i] - s[i - 1] - t;
        if (dp[0][i] < va) {
          dp[0][i] = va;
          pre[0][i][0] = 0, pre[0][i][1] = i - 1;
        }
      }
    } else {
      if (dp[0][i - 1] >= 0) {
        int va = dp[0][i - 1] + s[i] - s[i - 1];
        if (dp[0][i] < va) {
          dp[0][i] = va;
          pre[0][i][0] = 0, pre[0][i][1] = i - 1;
        }
      }
    }
    if (vis[1][i]) {
      if (dp[1][i - 1] + s[i] - s[i - 1] - 1 >= t) {
        int va = dp[1][i - 1] + s[i] - s[i - 1] - t;
        if (dp[1][i] < va)
          dp[1][i] = va, pre[1][i][0] = 1, pre[1][i][1] = i - 1;
      }
    } else {
      if (dp[1][i - 1] >= 0) {
        int va = dp[1][i - 1] + s[i] - s[i - 1];
        if (dp[1][i] < va)
          dp[1][i] = va, pre[1][i][0] = 1, pre[1][i][1] = i - 1;
      }
    }
    if (!vis[0][i]) {
      int va = min(t, dp[1][i]);
      if (va > dp[0][i]) {
        dp[0][i] = va;
        pre[0][i][0] = 1, pre[0][i][1] = i;
      }
    }
    if (!vis[1][i]) {
      int va = min(t, dp[0][i]);
      if (va > dp[1][i]) {
        dp[1][i] = va;
        pre[1][i][0] = 0, pre[1][i][1] = i;
      }
    }
  }
  if (dp[0][tot] < 0 && dp[1][tot] < 0) {
    puts("No");
    return 0;
  }
  puts("Yes");
  int tx = 0, ty = tot, ct = 0;
  if (dp[tx][ty] < 0) tx = 1;
  while (ty > 0) {
    if (pre[tx][ty][0] ^ tx) {
      ts[++ct] = ty;
    }
    int nx = pre[tx][ty][0], ny = pre[tx][ty][1];
    tx = nx, ty = ny;
  }
  if (tx) ts[++ct] = 0;
  reverse(ts + 1, ts + 1 + ct);
  printf("%d\n", ct);
  for (int i = 1; i <= ct; i++) printf("%d ", s[ts[i]]);
  puts("");
  int ti = 0, tc = 0;
  if (ts[ct] != tot) ts[++ct] = tot;
  for (int i = 1; i <= ct; i++) {
    if (ts[i] == 0) {
      tc ^= 1;
      continue;
    }
    int ci = su[ts[i]][tc] - su[ts[i - 1]][tc];
    int fi = t - ti + s[ts[i - 1]];
    for (int j = 0; j < ci; j++, fi += t) {
      ans[++cn][0] = tc, ans[cn][1] = fi;
    }
    int nc = t - ti + s[ts[i - 1]] + (ci - 1) * t;
    ti = min(s[ts[i]] - nc, t);
    tc ^= 1;
  }
  printf("%d\n", cn);
  for (int i = 1; i <= cn; i++) printf("%d %d\n", ans[i][1], ans[i][0] + 1);
}
