#include <bits/stdc++.h>
using namespace std;
vector<int> G[150000];
vector<int> vh;
map<int, bool> con[150000];
bool mark[150000];
int main() {
  int n, m, h, t;
  int a, b;
  scanf(" %d %d %d %d", &n, &m, &h, &t);
  for (int i = 0; i < m; i++) {
    scanf(" %d %d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
    con[a][b] = true;
    con[b][a] = true;
  }
  for (int i = 1; i <= n; i++)
    if (G[i].size() - 1 >= h) vh.push_back(i);
  for (int i = 0; i < vh.size(); i++) {
    int u = vh[i];
    int sum = G[u].size() - 1;
    for (int j = 0; j < G[u].size(); j++) {
      int v = G[u][j];
      if (G[v].size() - 1 < t) continue;
      int total = sum;
      for (int k = 0; k < G[v].size() && total < h + t; k++)
        if (G[v][k] != u && !con[u][G[v][k]]) total++;
      if (total >= h + t) {
        int used = 0;
        printf("YES\n");
        printf("%d %d\n", u, v);
        for (int i = 0; i < G[u].size() && used < h; i++)
          if (G[u][i] != v && !con[v][G[u][i]]) {
            mark[G[u][i]] = true;
            printf("%d ", G[u][i]);
            used++;
          }
        for (int i = 0; i < G[u].size() && used < h; i++)
          if (G[u][i] != v && !mark[G[u][i]]) {
            mark[G[u][i]] = true;
            printf("%d ", G[u][i]);
            used++;
          }
        printf("\n");
        for (int i = 0; i < G[v].size() && t; i++)
          if (G[v][i] != u && !mark[G[v][i]]) {
            printf("%d ", G[v][i]);
            t--;
          }
        printf("\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
