#include <bits/stdc++.h>
using namespace std;
long long const MAXN = 1e5 + 10, MAXM = 4e5 + 10;
long long n, m, T, a[MAXN], hh, tt;
long long vis[MAXN];
vector<long long> g[MAXN];
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
}
long long check(long long x, long long y) {
  long long HH = 0, TT = 0;
  for (long long i = 1; i <= n; ++i) vis[i] = 0;
  for (long long i = 0; i < g[x].size(); ++i) {
    long long j = g[x][i];
    if (j != y) vis[j] = x, HH++;
  }
  for (long long i = 0; i < g[y].size(); ++i) {
    long long j = g[y][i];
    if (j != x && vis[j] != x) vis[j] = y, TT++;
  }
  for (long long i = 0; i < g[y].size(); ++i) {
    long long j = g[y][i];
    if (j != x && vis[j] == x && HH > hh) vis[j] = y, TT++, HH--;
  }
  if (HH >= hh && TT >= tt) {
    cout << "YES\n";
    cout << x << " " << y << endl;
    for (long long i = 0; i < g[x].size(); ++i) {
      long long j = g[x][i];
      if (vis[j] == x) {
        write(j);
        printf(" ");
        hh--;
      }
      if (!hh) break;
    }
    cout << endl;
    for (long long i = 0; i < g[y].size(); ++i) {
      long long j = g[y][i];
      if (vis[j] == y) {
        write(j);
        printf(" ");
        tt--;
      }
      if (!tt) break;
    }
    return 1;
  }
  return 0;
}
signed main() {
  cin >> n >> m >> hh >> tt;
  for (long long i = 1; i <= m; ++i) {
    long long a, b;
    a = read(), b = read();
    g[a].push_back(b), g[b].push_back(a);
  }
  for (long long i = 1; i <= n; ++i) {
    if (g[i].size() <= hh) continue;
    for (long long j = 0; j < g[i].size(); ++j) {
      long long k = g[i][j];
      if (g[k].size() <= tt) continue;
      if (check(i, k)) {
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
