#include <bits/stdc++.h>
using namespace std;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
constexpr long long TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U>
void chmin(T& t, const U& u) {
  if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
  if (t < u) t = u;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = 0; i < (v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
bool ex(const V<int>& vec, int x) {
  auto p = lower_bound((vec).begin(), (vec).end(), x) - vec.begin();
  if (p < vec.size() && vec[p] == x) {
    return true;
  } else {
    return false;
  }
}
const int maxn = 2000010;
int dp[2][maxn];
pair<int, int> pre[2][maxn];
int main() {
  int n, m1, m2, t;
  scanf("%d %d %d %d", &n, &m1, &m2, &t);
  V<int> v1(m1), v2(m2);
  V<int> xs((m1 + m2) * 2);
  int now = 0;
  for (int i = 0; i < (m1); i++) {
    scanf("%d", &v1[i]);
    xs[now++] = v1[i];
    xs[now++] = v1[i] + 1;
  }
  for (int i = 0; i < (m2); i++) {
    scanf("%d", &v2[i]);
    xs[now++] = v2[i];
    xs[now++] = v2[i] + 1;
  }
  xs.push_back(0);
  xs.push_back(n + 1);
  sort((xs).begin(), (xs).end());
  xs.erase(unique((xs).begin(), (xs).end()), xs.end());
  true;
  memset(dp, -1, sizeof(dp));
  dp[0][0] = dp[1][0] = 0;
  pre[1][0] = make_pair(0, 0);
  for (int i = 1; i < xs.size(); ++i) {
    for (int r = 0; r < (2); r++) {
      if (dp[r][i - 1] != -1) {
        int nx = dp[r][i - 1] + xs[i] - xs[i - 1] - 1;
        if (ex((r == 0 ? v1 : v2), xs[i])) {
          if (nx >= t) {
            if (dp[r][i] < nx - t + 1) {
              pre[r][i] = make_pair(r, i - 1);
              dp[r][i] = nx - t + 1;
            }
          }
        } else {
          if (dp[r][i] < nx + 1) {
            dp[r][i] = nx + 1;
            pre[r][i] = make_pair(r, i - 1);
          }
        }
      }
    }
    if (!ex(v1, xs[i])) {
      int nx = min(t, dp[1][i]);
      if (dp[0][i] < nx) {
        dp[0][i] = nx;
        pre[0][i] = make_pair(1, i);
      }
    }
    if (!ex(v2, xs[i])) {
      int nx = min(t, dp[0][i]);
      if (dp[1][i] < nx) {
        dp[1][i] = nx;
        pre[1][i] = make_pair(0, i);
      }
    }
  }
  if (dp[1][xs.size() - 1] == -1 && dp[0][xs.size() - 1] == -1) {
    puts("No");
    return 0;
  }
  puts("Yes");
  int r = -1, c = -1;
  V<pair<int, int>> vec;
  V<int> turns;
  for (int i = 0; i < (2); i++) {
    if (dp[i][xs.size() - 1] != -1) {
      r = i, c = xs.size() - 1;
      break;
    }
  }
  V<pair<int, int>> fires;
  const int INF = TEN(9) * 2;
  int la = INF;
  while (true) {
    vec.emplace_back(r, c);
    if (make_pair(r, c) == make_pair(0, 0)) {
      break;
    }
    pair<int, int> nx = pre[r][c];
    if (c == nx.second) {
      turns.emplace_back(xs[c]);
    } else {
      if (dp[r][c] < dp[nx.first][nx.second] + xs[c] - xs[nx.second]) {
        fires.emplace_back(r, min(xs[c] - 1, la - t));
        la = min(xs[c] - 1, la - t);
      }
    }
    tie(r, c) = nx;
  }
  reverse((turns).begin(), (turns).end());
  reverse((fires).begin(), (fires).end());
  int nt = turns.size();
  printf("%d\n", nt);
  for (int i = 0; i < (nt); i++) {
    printf("%d ", turns[i]);
  }
  puts("");
  int nf = fires.size();
  printf("%d\n", nf);
  for (int i = 0; i < (nf); i++) {
    printf("%d %d\n", fires[i].second, fires[i].first + 1);
  }
  return 0;
}
