#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adjlist(100001);
vector<pair<int, int> > Edges;
int vis[100001];
int Comm[100001];
int TakenComm[100001];
int main() {
  int n, m, h, t;
  scanf("%d%d%d%d", &n, &m, &h, &t);
  memset(vis, -1, sizeof vis);
  memset(Comm, -1, sizeof Comm);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    Edges.push_back(make_pair(a, b));
    Edges.push_back(make_pair(b, a));
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
  }
  for (int i = 0; i < 2 * m; i++) {
    int head = Edges[i].first;
    int tail = Edges[i].second;
    int uniquehead = 0, uniquetail = 0, common = 0;
    for (int j = 0; j < min(201, (int)adjlist[head].size()); j++) {
      if (adjlist[head][j] == tail) continue;
      vis[adjlist[head][j]] = i;
      uniquehead++;
    }
    for (int j = 0; j < min(201, (int)adjlist[tail].size()); j++) {
      if (adjlist[tail][j] == head) continue;
      if (vis[adjlist[tail][j]] != i)
        uniquetail++;
      else
        common++, Comm[adjlist[tail][j]] = i;
    }
    uniquehead -= common;
    if (uniquehead + uniquetail + common >= t + h && uniquehead + common >= h &&
        uniquetail + common >= t) {
      printf("YES\n%d %d\n", head, tail);
      int commontakenfromhead = 0, commontakenfromtail = 0;
      if (uniquehead < h) commontakenfromhead = h - uniquehead;
      if (uniquetail < t) commontakenfromtail = t - uniquetail;
      for (int j = 0; h; j++) {
        if (adjlist[head][j] == tail) continue;
        if (Comm[adjlist[head][j]] != i) {
          h--;
          printf("%d%c", adjlist[head][j], " \n"[h == 0]);
        } else if (commontakenfromhead) {
          commontakenfromhead--;
          h--;
          TakenComm[adjlist[head][j]] = 1;
          printf("%d%c", adjlist[head][j], " \n"[h == 0]);
        }
      }
      for (int j = 0; t; j++) {
        if (adjlist[tail][j] == head) continue;
        if (Comm[adjlist[tail][j]] != i) {
          t--;
          printf("%d%c", adjlist[tail][j], " \n"[t == 0]);
        } else if (commontakenfromtail && !TakenComm[adjlist[tail][j]]) {
          commontakenfromtail--;
          t--;
          printf("%d%c", adjlist[tail][j], " \n"[t == 0]);
        }
      }
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
