#include <bits/stdc++.h>
using namespace std;
int dp[2000009][2];
int memo[2000009][2];
struct obstacle {
  int pos;
  bool ok[2];
};
obstacle obs[2000009];
vector<int> o1, o2;
int cnt = 0;
void add(int val, bool a, bool b) {
  if (cnt > 0 && obs[cnt - 1].pos == val) cnt--;
  obs[cnt].pos = val;
  obs[cnt].ok[0] = a;
  obs[cnt].ok[1] = b;
  cnt++;
  obs[cnt].pos = val + 1;
  cnt++;
}
int merge(int n) {
  sort(o1.begin(), o1.end());
  sort(o2.begin(), o2.end());
  add(0, false, false);
  int i1 = 0, i2 = 0;
  while (i1 < o1.size() && i2 < o2.size()) {
    if (o1[i1] == o2[i2]) {
      add(o1[i1], true, true);
      i1++;
      i2++;
    } else if (o1[i1] < o2[i2]) {
      add(o1[i1], true, false);
      i1++;
    } else {
      add(o2[i2], false, true);
      i2++;
    }
  }
  while (i1 < o1.size()) {
    add(o1[i1], true, false);
    i1++;
  }
  while (i2 < o2.size()) {
    add(o2[i2], false, true);
    i2++;
  }
  add(n + 1, false, false);
  return cnt;
}
int main() {
  int n, m1, m2, t, v;
  scanf("%d %d %d %d", &n, &m1, &m2, &t);
  for (int x = 0; x < m1; x++) {
    scanf("%d", &v);
    o1.push_back(v);
  }
  for (int x = 0; x < m2; x++) {
    scanf("%d", &v);
    o2.push_back(v);
  }
  int idx = 0;
  merge(n);
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  memo[0][0] = 0;
  dp[0][1] = 0;
  memo[0][1] = 1;
  for (int i = 1; i <= cnt - 1; i++) {
    for (int j = 0; j < 2; j++) {
      if (dp[i - 1][j] < 0) continue;
      int cur = obs[i].pos, prv = obs[i - 1].pos;
      if (obs[i].ok[j]) {
        if (dp[i - 1][j] + (cur - prv - 1) >= t)
          dp[i][j] = dp[i - 1][j] - t + (cur - prv);
      } else {
        dp[i][j] = dp[i - 1][j] + (cur - prv);
      }
      memo[i][j] = 0;
    }
    int prv[2];
    prv[0] = dp[i][0], prv[1] = dp[i][1];
    for (int j = 0; j < 2; j++) {
      if (obs[i].ok[j]) {
      } else {
        if (prv[j ^ 1] >= 0 && min(prv[j ^ 1], t) > dp[i][j]) {
          dp[i][j] = min(prv[j ^ 1], t);
          memo[i][j] = 1;
        }
      }
    }
  }
  if (dp[cnt - 1][0] >= 0 || dp[cnt - 1][1] >= 0) {
    puts("Yes");
    int i = cnt - 1, j = dp[cnt - 1][0] >= 0 ? 0 : 1;
    vector<int> turns;
    vector<pair<int, int> > shots;
    int avail = n + t + 1;
    while (i >= 0) {
      if (obs[i].ok[j]) {
        avail = min(avail - t, obs[i].pos - 1);
        shots.push_back(pair<int, int>(avail, j + 1));
      }
      if (memo[i][j] == 1) {
        turns.push_back(obs[i].pos);
        j ^= 1;
      } else if (memo[i][j] == 0) {
        i--;
      }
    }
    reverse(turns.begin(), turns.end());
    reverse(shots.begin(), shots.end());
    printf("%d\n", (int)turns.size());
    for (i = 0; i < (int)turns.size(); i++) printf("%d ", turns[i]);
    printf("\n%d\n", (int)shots.size());
    for (i = 0; i < (int)shots.size(); i++)
      printf("%d %d\n", shots[i].first, shots[i].second);
  } else
    puts("No");
}
