#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 2000007;
int N, n, m1, m2, T;
int a1[MAXN], a2[MAXN];
int px[MAXN];
int dp[MAXN][2];
bool af[MAXN][2];
pair<int, int> pre[MAXN][2];
void init();
void input();
void work();
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d%d%d%d", &N, &m1, &m2, &T);
  for (int i = 1; i <= m1; ++i) scanf("%d", &a1[i]);
  for (int i = 1; i <= m2; ++i) scanf("%d", &a2[i]);
}
void work() {
  a1[m1 + 1] = a2[m2 + 1] = INF;
  n = 0;
  int ni1 = 1, ni2 = 1;
  while (ni1 <= m1 || ni2 <= m2) {
    if (a1[ni1] < a2[ni2]) {
      if (a1[ni1] > px[n]) px[++n] = a1[ni1];
      if (a1[ni1] + 1 > px[n]) px[++n] = a1[ni1] + 1;
      ++ni1;
    } else {
      if (a2[ni2] > px[n]) px[++n] = a2[ni2];
      if (a2[ni2] + 1 > px[n]) px[++n] = a2[ni2] + 1;
      ++ni2;
    }
  }
  while (px[n] > N) --n;
  if (px[n] ^ N) px[++n] = N;
  bool f1, f2;
  ni1 = 1, ni2 = 1;
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  dp[0][0] = dp[0][1] = 0;
  pre[0][0] = make_pair(-1, -1);
  pre[0][1] = make_pair(0, 0);
  for (int i = 1; i <= n; ++i) {
    if (a1[ni1 + 1] == px[i]) ++ni1;
    if (a2[ni2 + 1] == px[i]) ++ni2;
    f1 = (a1[ni1] == px[i]);
    f2 = (a2[ni2] == px[i]);
    af[i][0] = f1, af[i][1] = f2;
    if ((!(i - 1) || dp[i - 1][0] < px[i - 1]) &&
        dp[i - 1][0] + (f1 ? T : 0) < dp[i][0])
      dp[i][0] = dp[i - 1][0] + (f1 ? T : 0), pre[i][0] = make_pair(i - 1, 0);
    if ((!(i - 1) || dp[i - 1][1] < px[i - 1]) &&
        dp[i - 1][1] + (f2 ? T : 0) < dp[i][1])
      dp[i][1] = dp[i - 1][1] + (f2 ? T : 0), pre[i][1] = make_pair(i - 1, 1);
    if (!f1 &&
        (((dp[i][1]) > (px[i] - T)) ? (dp[i][1]) : (px[i] - T)) < dp[i][0])
      dp[i][0] = (((dp[i][1]) > (px[i] - T)) ? (dp[i][1]) : (px[i] - T)),
      pre[i][0] = make_pair(i, 1);
    if (!f2 &&
        (((dp[i][0]) > (px[i] - T)) ? (dp[i][0]) : (px[i] - T)) < dp[i][1])
      dp[i][1] = (((dp[i][0]) > (px[i] - T)) ? (dp[i][0]) : (px[i] - T)),
      pre[i][1] = make_pair(i, 0);
  }
  int nt = (dp[n][0] < N) ? 0 : 1;
  if (dp[n][nt] < N) {
    printf("Yes\n");
    vector<pair<int, int> > shoot;
    vector<int> flip;
    int cur = n, pc, pt;
    while (~cur) {
      if (af[cur][nt]) shoot.push_back(make_pair(dp[cur][nt], nt));
      pc = cur, pt = nt, cur = pre[pc][pt].first, nt = pre[pc][pt].second;
      if (cur == pc) flip.push_back(px[cur]);
    }
    reverse(shoot.begin(), shoot.end());
    reverse(flip.begin(), flip.end());
    printf("%d\n", flip.size());
    for (auto x : flip) printf("%d ", x);
    putchar('\n');
    printf("%d\n", shoot.size());
    for (auto x : shoot) printf("%d %d\n", x.first, x.second + 1);
  } else
    printf("No\n");
}
