#include <bits/stdc++.h>
using namespace std;
int n, m, h, t, a, b;
int d[100010];
vector<int> adj[100010];
vector<pair<int, int> > are;
vector<int> restail, reshead;
vector<int> spool;
bool tenta(int head, int tail) {
  int tt = t;
  int th = h;
  int ph = 0;
  int pt = 0;
  spool.clear();
  while (ph < (int)adj[head].size() and pt < (int)adj[tail].size()) {
    if (th == 0 and tt == 0) return true;
    if (adj[head][ph] == adj[tail][pt]) {
      spool.push_back(adj[head][ph]);
      ph++;
      pt++;
    } else if (adj[head][ph] < adj[tail][pt]) {
      if (adj[head][ph] == tail) {
        ph++;
        continue;
      }
      if (th) {
        reshead.push_back(adj[head][ph]);
        th--;
      }
      ph++;
    } else {
      if (adj[tail][pt] == head) {
        pt++;
        continue;
      }
      if (tt) {
        restail.push_back(adj[tail][pt]);
        tt--;
      }
      pt++;
    }
  }
  while (ph < (int)adj[head].size()) {
    if (adj[head][ph] == tail) {
      ph++;
      continue;
    }
    if (th) {
      reshead.push_back(adj[head][ph]);
      th--;
    }
    ph++;
  }
  while (pt < (int)adj[tail].size()) {
    if (adj[tail][ph] == head) {
      pt++;
      continue;
    }
    if (tt) {
      restail.push_back(adj[tail][pt]);
      tt--;
    }
    pt++;
  }
  if (tt + th <= (int)spool.size()) {
    int pos = 0;
    for (int i = 0; i < th; i++) reshead.push_back(spool[pos++]);
    for (int i = 0; i < tt; i++) restail.push_back(spool[pos++]);
    return true;
  }
  return false;
}
int main() {
  memset(d, 0, sizeof(d));
  scanf("%d %d %d %d", &n, &m, &h, &t);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    d[a]++;
    d[b]++;
    are.push_back(pair<int, int>(a, b));
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end());
  for (int i = 0; i < m; i++) {
    a = are[i].first;
    b = are[i].second;
    restail.clear();
    reshead.clear();
    if (d[a] - 1 >= h and d[b] - 1 >= t)
      if (tenta(a, b)) {
        printf("YES\n");
        printf("%d %d\n", a + 1, b + 1);
        for (int i = 0; i < (int)reshead.size(); i++)
          printf("%d ", reshead[i] + 1);
        printf("\n");
        for (int i = 0; i < (int)restail.size(); i++)
          printf("%d ", restail[i] + 1);
        printf("\n");
        return 0;
      }
    restail.clear();
    reshead.clear();
    if (d[b] - 1 >= h and d[a] - 1 >= t)
      if (tenta(b, a)) {
        printf("YES\n");
        printf("%d %d\n", b + 1, a + 1);
        for (int i = 0; i < (int)reshead.size(); i++)
          printf("%d ", reshead[i] + 1);
        printf("\n");
        for (int i = 0; i < (int)restail.size(); i++)
          printf("%d ", restail[i] + 1);
        printf("\n");
        return 0;
      }
  }
  printf("NO\n");
  return 0;
}
