#include <bits/stdc++.h>
using namespace std;
struct rec1 {
  int x, y, n;
  bool f;
} l[500000];
int n, m, x1, x2, i, ln, b[100010], u[100010], v[100010], al[100010];
map<int, int> sta[100010];
void insert(int x, int y) {
  l[++ln].x = x;
  l[ln].y = y;
  l[ln].n = b[x];
  b[x] = ln;
  l[++ln].x = y;
  l[ln].y = x;
  l[ln].n = b[y];
  b[y] = ln;
  return;
}
bool try1(int num1, int num2, int num3) {
  num1 -= num3;
  num2 -= num3;
  if (num1 < x1) num3 -= x1 - num1;
  if (num3 < 0) return false;
  if (num2 + num3 < x2) return false;
  return true;
}
int print(int x, int y) {
  int num1 = 0, num2 = 0, num3 = 0;
  for (map<int, int>::iterator iter = sta[y].begin(); iter != sta[y].end();
       iter++) {
    if (iter->first == x) continue;
    if (sta[x].find(iter->first) != sta[x].end())
      al[++num3] = iter->first;
    else
      v[++num2] = iter->first;
  }
  for (map<int, int>::iterator iter = sta[x].begin(); iter != sta[x].end();
       iter++) {
    if (iter->first == y) continue;
    if (sta[y].find(iter->first) == sta[y].end()) u[++num1] = iter->first;
  }
  printf("YES\n%d %d\n", x, y);
  for (i = 1; i <= min(num1, x1); i++) printf("%d ", u[i]);
  if (num1 < x1)
    for (i = num3; num1 < x1; i--, num3--, num1++) printf("%d ", al[i]);
  printf("\n");
  for (i = 1; i <= min(num2, x2); i++) printf("%d ", v[i]);
  if (num2 < x2)
    for (i = num3; num2 < x2; i--, num3--, num2++) printf("%d ", al[i]);
  printf("\n");
  return 0;
}
bool check(int x) {
  for (int k = b[x]; k != -1; k = l[k].n) {
    if (l[k].f) continue;
    l[k].f = l[k ^ 1].f = true;
    int num1 = sta[x].size() - 1, num2 = sta[l[k].y].size() - 1, num3 = 0;
    if ((!try1(num1, num2, num3)) && (!try1(num2, num1, num3))) continue;
    for (map<int, int>::iterator iter = sta[l[k].y].begin();
         iter != sta[l[k].y].end(); iter++) {
      if (sta[x].find(iter->first) != sta[x].end()) num3++;
    }
    if (try1(num1, num2, num3)) {
      print(x, l[k].y);
      return true;
    }
    if (try1(num2, num1, num3)) {
      print(l[k].y, x);
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &x1, &x2);
  ln = -1;
  memset(b, -1, sizeof(b));
  for (i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    insert(x, y);
    sta[x].insert(make_pair(y, 0));
    sta[y].insert(make_pair(x, 0));
  }
  for (i = 1; i <= n; i++)
    if (check(i)) return 0;
  printf("NO\n");
  return 0;
}
