#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx")
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T1, class T2>
inline void print(T1 x1, T2 x2) {
  printsp(x1), println(x2);
}
template <class T1, class T2, class T3>
inline void print(T1 x1, T2 x2, T3 x3) {
  printsp(x1), printsp(x2), println(x3);
}
template <class T1, class T2, class T3, class T4>
inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {
  printsp(x1), printsp(x2), printsp(x3), println(x4);
}
template <class T>
inline void eprint(T first) {
  cerr << "--------> " << first << endl;
}
template <class T1, class T2>
inline void eprint(T1 first, T2 second) {
  cerr << "--------> " << first << ' ' << second << endl;
}
template <class T1, class T2, class T3>
inline void eprint(T1 first, T2 second, T3 z) {
  cerr << " -------> " << first << ' ' << second << ' ' << z << endl;
}
template <class T1, class T2, class T3, class T4>
inline void eprint(T1 first, T2 second, T3 z, T4 w) {
  cerr << " -------> " << first << ' ' << second << ' ' << z << ' ' << w
       << endl;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
int n, t;
int m1, m2;
int B[2][2001111];
int nb[2];
int dp[2][2001111];
int arr[2001111];
int flag[2][2001111];
int nn;
pair<int, int> who[2][2001111];
pair<int, int> path[2001111];
pair<int, int> obs[2001111];
int no;
int np;
int tran[2001111];
int nt;
inline int get(int u) { return lower_bound(arr, arr + nn, u) - arr; }
inline bool is(int now, int i) {
  if (arr[now + 1] == arr[now] + 1 and flag[i][now + 1]) return 1;
  return 0;
  return binary_search(B[i], B[i] + nb[i], now);
}
inline int is1(int now, int i) {
  return binary_search(B[i], B[i] + nb[i], now);
}
inline void update(int i, int j, int pi, int pj, int v) {
  if (dp[i][j] == -1)
    dp[i][j] = v, who[i][j] = pair<int, int>(pi, pj);
  else if (v > dp[i][j])
    dp[i][j] = v, who[i][j] = pair<int, int>(pi, pj);
}
int solve() {
  cin >> n >> m1 >> m2 >> t;
  int sta = 0;
  for (int i = 0; i < m1; i++) {
    int first;
    gn(first);
    if (first == 1) sta |= 1;
    B[0][i] = first;
    arr[nn++] = first + 1;
  }
  for (int i = 0; i < m2; i++) {
    int first;
    gn(first);
    B[1][i] = first;
    if (first == 2) sta |= 2;
    arr[nn++] = first + 1;
  }
  nb[0] = m1;
  nb[1] = m2;
  if (sta == 3) return 0;
  arr[nn++] = 0;
  arr[nn++] = n + 1;
  sort(arr, arr + nn);
  nn = unique(arr, arr + nn) - arr;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < nb[i]; j++) {
      int u = B[i][j];
      u = get(u + 1);
      flag[i][u] = 1;
    }
  }
  memset(dp, -1, sizeof dp);
  if (sta != 1) dp[0][0] = 0;
  if (sta != 2) dp[1][0] = 0;
  for (int j = 1; j < nn; j++) {
    for (int i = 0; i < 2; i++) {
      int pre = arr[j - 1];
      int nxt = arr[j];
      int you = is(j, i);
      if (~dp[i][j - 1]) {
        if (pre + 1 == nxt) {
          if (you) {
            int tmp = dp[i][j - 1];
            if (tmp >= t) {
              tmp -= t;
              tmp++;
              update(i, j, i, j - 1, tmp);
            }
          } else {
            update(i, j, i, j - 1, dp[i][j - 1] + 1);
          }
        } else {
          if (flag[i][j]) {
            if (you) {
              int tmp = dp[i][j - 1] + nxt - pre - 2;
              if (tmp >= t) {
                tmp -= t;
                tmp++;
                if (tmp >= t) {
                  tmp -= t;
                  tmp++;
                  update(i, j, i, j - 1, tmp);
                }
              }
            } else {
              int tmp = dp[i][j - 1] + nxt - pre - 2;
              if (tmp >= t) {
                tmp -= t;
                tmp += 2;
                update(i, j, i, j - 1, tmp);
              }
            }
          } else {
            if (you) {
              int tmp = dp[i][j - 1] + nxt - pre - 1;
              if (tmp >= t) {
                tmp -= t;
                tmp++;
                update(i, j, i, j - 1, tmp);
              }
            } else {
              int tmp = dp[i][j - 1] + nxt - pre;
              update(i, j, i, j - 1, tmp);
            }
          }
        }
      }
      if (is(j - 1, i) == 0 and dp[i ^ 1][j - 1] != -1) {
        int d = dp[i ^ 1][j - 1];
        if (d >= t) d = t;
        if (pre + 1 == nxt) {
          if (you) {
            int tmp = d;
            if (tmp >= t) {
              tmp -= t;
              tmp++;
              update(i, j, i ^ 1, j - 1, tmp);
            }
          } else {
            update(i, j, i ^ 1, j - 1, d + 1);
          }
        } else {
          if (flag[i][j]) {
            if (you) {
              int tmp = d + nxt - pre - 2;
              if (tmp >= t) {
                tmp -= t;
                tmp++;
                if (tmp >= t) {
                  tmp -= t;
                  tmp++;
                  update(i, j, i ^ 1, j - 1, tmp);
                }
              }
            } else {
              int tmp = d + nxt - pre - 2;
              if (tmp >= t) {
                tmp -= t;
                tmp += 2;
                update(i, j, i ^ 1, j - 1, tmp);
              }
            }
          } else {
            if (you) {
              int tmp = d + nxt - pre - 1;
              if (tmp >= t) {
                tmp -= t;
                tmp++;
                update(i, j, i ^ 1, j - 1, tmp);
              }
            } else {
              int tmp = d + nxt - pre;
              update(i, j, i ^ 1, j - 1, tmp);
            }
          }
        }
      }
    }
  }
  if (dp[0][nn - 1] == -1 and dp[1][nn - 1] == -1) return 0;
  cout << "Yes" << endl;
  pair<int, int> now;
  if (~dp[0][nn - 1])
    now = pair<int, int>(0, nn - 1);
  else
    now = pair<int, int>(1, nn - 1);
  while (1) {
    path[np++] = now;
    if (is(now.second, now.first))
      obs[no++] = pair<int, int>(arr[now.second], now.first);
    if (flag[now.first][now.second])
      obs[no++] = pair<int, int>(arr[now.second] - 1, now.first);
    if (now.second == 0) break;
    now = who[now.first][now.second];
  }
  reverse(path, path + np);
  int cur = 0, pp = 0;
  for (int i = 0; i < np; i++) {
    pair<int, int> tmp = path[i];
    if (tmp.first != cur) tran[nt++] = arr[pp];
    cur = tmp.first;
    pp = tmp.second;
  }
  println(nt);
  for (int i = 0; i < nt; i++) printsp(tran[i]);
  puts("");
  sort(obs, obs + no);
  no = unique(obs, obs + no) - obs;
  reverse(obs, obs + no);
  cur = 0x3f3f3f3f;
  for (int i = 0; i < no; i++) {
    pair<int, int> &u = obs[i];
    cur = u.first = min(u.first - 1, cur - t);
  }
  reverse(obs, obs + no);
  println(no);
  for (int i = 0; i < no; i++) {
    pair<int, int> tmp = obs[i];
    print(tmp.first, tmp.second + 1);
  }
  return 1;
}
int main() {
  if (solve() == 0) return puts("No");
  return 0;
}
