#include <bits/stdc++.h>
using namespace std;
vector<int> p[100004];
int vist[100004], comm[100004];
bool mark[100004];
int n, m, h, t, id;
bool jud(int u, int v) {
  if (p[u].size() <= h || p[v].size() <= t) return false;
  id++;
  for (int i = 0; i < p[u].size(); i++) {
    if (p[u][i] != v) vist[p[u][i]] = id;
  }
  int s = 0;
  for (int i = 0; i < p[v].size(); i++)
    if (p[v][i] != u && vist[p[v][i]] == id) {
      s++;
    }
  if (p[u].size() + p[v].size() - s < h + t + 2) return false;
  return true;
}
void output(int u, int v) {
  int i, j, s;
  id++;
  for (i = 0; i < p[v].size(); i++) {
    if (p[v][i] != u) {
      vist[p[v][i]] = id;
    }
  }
  j = 0;
  memset(mark, false, sizeof(mark));
  for (i = 0, j = 0; i < p[u].size(); i++) {
    if (p[u][i] != v && vist[p[u][i]] == id) {
      mark[p[u][i]] = true;
      comm[j++] = p[u][i];
    }
  }
  printf("YES\n%d %d\n", u, v);
  for (i = 0, s = 0; i < p[u].size(); i++)
    if (p[u][i] != v && mark[p[u][i]] == false) {
      printf("%d", p[u][i]);
      s++;
      if (s == h) {
        printf("\n");
        break;
      } else
        printf(" ");
    }
  j = 0;
  while (s < h) {
    printf("%d", comm[j++]);
    s++;
    if (s == h) {
      printf("\n");
      break;
    } else
      printf(" ");
  }
  s = 0;
  for (i = 0; i < p[v].size(); i++) {
    if (p[v][i] != u && mark[p[v][i]] == false) {
      printf("%d", p[v][i]);
      s++;
      if (s == t) {
        printf("\n");
        break;
      } else
        printf(" ");
    }
  }
  while (s < t) {
    printf("%d", comm[j++]);
    s++;
    if (s == t) {
      printf("\n");
      break;
    } else
      printf(" ");
  }
}
int main() {
  int i, j, x, y;
  while (scanf("%d%d%d%d", &n, &m, &h, &t) != EOF) {
    for (i = 0; i <= n; i++) {
      p[i].clear();
    }
    for (i = 1; i <= m; i++) {
      scanf("%d%d", &x, &y);
      p[x].push_back(y);
      p[y].push_back(x);
    }
    id = 0;
    int flag = 0;
    for (i = 1; i <= n && !flag; i++) {
      for (j = p[i].size() - 1; j >= 0; j--)
        if (jud(i, p[i][j])) {
          output(i, p[i][j]);
          flag = 1;
          break;
        }
    }
    if (!flag) {
      printf("NO\n");
    }
  }
  return 0;
}
