#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int h, t;
set<int> G[N];
vector<int> g[N];
bool check(int gr, int ji) {
  int sw = 0;
  int com = 0;
  if (((int)g[gr].size()) > ((int)g[ji].size())) swap(gr, ji), sw = 1;
  for (int i = 0; i < ((int)g[gr].size()); i++) com += G[ji].count(g[gr][i]);
  if (sw) swap(gr, ji);
  int l = ((int)g[gr].size()) - 1 - com;
  int r = ((int)g[ji].size()) - 1 - com;
  if (h + t > l + r + com || h > l + com || t > r + com) return 0;
  vector<int> f, m, s;
  for (int i = 0; i < ((int)g[gr].size()); i++) {
    int to = g[gr][i];
    if (to == ji) continue;
    if (!G[ji].count(to))
      f.push_back(to);
    else
      m.push_back(to);
  }
  for (int i = 0; i < ((int)g[ji].size()); i++) {
    int to = g[ji][i];
    if (to == gr) continue;
    if (!G[gr].count(g[ji][i])) s.push_back(to);
  }
  int cur = 0;
  while (((int)f.size()) < h) f.push_back(m[cur++]);
  while (((int)s.size()) < t) s.push_back(m[cur++]);
  puts("YES");
  printf("%d %d\n", gr + 1, ji + 1);
  for (int i = 0; i < h; i++) printf("%d ", f[i] + 1);
  printf("\n");
  for (int i = 0; i < t; i++) printf("%d ", s[i] + 1);
  printf("\n");
  return 1;
}
int main() {
  int n, m;
  scanf("%d %d %d %d", &n, &m, &h, &t);
  for (int i = 0; i < m; i++) {
    int s, e;
    scanf("%d %d", &s, &e);
    --s;
    --e;
    g[s].push_back(e);
    g[e].push_back(s);
    G[s].insert(e);
    G[e].insert(s);
  }
  for (int i = 0; i < n; i++) {
    if (((int)g[i].size()) < h) continue;
    for (int j = 0; j < ((int)g[i].size()); j++) {
      int ji = g[i][j];
      if (((int)g[ji].size()) < t) continue;
      if (check(i, ji)) return 0;
    }
  }
  puts("NO");
  return 0;
}
