#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
int main() {
  int n, m1, m2, t;
  scanf("%d%d%d%d", &n, &m1, &m2, &t);
  map<int, int> has;
  map<int, int> change[2], change2[2];
  map<int, long long> tab[2];
  for (int i = 0; i < m1; ++i) {
    int x;
    scanf("%d", &x);
    has[x] |= 1;
  }
  for (int i = 0; i < m2; ++i) {
    int x;
    scanf("%d", &x);
    has[x] |= 2;
  }
  long long f = 0, g = INF;
  long long px = -1;
  for (auto e : has) {
    long long x = e.first;
    int typ = e.second;
    if (x > px + 1) {
      long long tf = f, tg = g;
      long long v = max(px + 1 - t, tg);
      if (v < f) {
        f = v;
        change2[0][x] = px + 1;
      }
      v = max(px + 1 - t, tf);
      if (v < g) {
        g = v;
        change2[1][x] = px + 1;
      }
    }
    if (typ == 1) {
      if (f + t < x)
        f += t;
      else
        f = INF;
      long long v = max(x - t, f);
      if (v < g) {
        g = v;
        change[1][x] = x;
      }
    } else if (typ == 2) {
      if (g + t < x)
        g += t;
      else
        g = INF;
      long long v = max(x - t, g);
      if (v < f) {
        f = v;
        change[0][x] = x;
      }
    } else {
      if (f + t < x)
        f += t;
      else
        f = INF;
      if (g + t < x)
        g += t;
      else
        g = INF;
    }
    tab[0][x] = f;
    tab[1][x] = g;
    px = x;
  }
  if (f == INF && g == INF)
    printf("No\n");
  else {
    int lane = (g < INF);
    vector<int> transits;
    vector<pair<int, int>> shots;
    for (auto it = has.rbegin(); it != has.rend(); ++it) {
      long long x = it->first;
      int typ = it->second;
      if (change[lane][x]) {
        transits.push_back(x);
        lane = 1 - lane;
      }
      if (typ & (1 << lane)) {
        shots.push_back({tab[lane][x], lane + 1});
      }
      if (change2[lane].count(x)) {
        transits.push_back(change2[lane][x]);
        lane = 1 - lane;
      }
    }
    reverse(shots.begin(), shots.end());
    reverse(transits.begin(), transits.end());
    printf("Yes\n");
    printf("%d\n", transits.size());
    for (int x : transits) printf("%d ", x);
    printf("\n");
    printf("%d\n", shots.size());
    for (auto x : shots) printf("%d %d\n", x.first, x.second);
  }
}
