#include <bits/stdc++.h>
using namespace std;
int n, m, h, t, b[100007], e[100007], deg[100007], mark[1000007];
vector<int> heads, tails;
vector<int> G[100007];
bool can(int u, int v) {
  heads.clear();
  tails.clear();
  if (deg[u] < h + 1 || deg[v] < t + 1) {
    return false;
  }
  vector<int> &hs = G[u];
  vector<int> &ts = G[v];
  for (int i = 0; i < hs.size(); ++i) {
    mark[hs[i]] = 0;
  }
  for (int i = 0; i < ts.size(); ++i) {
    mark[ts[i]] = 0;
  }
  for (int i = 0; i < hs.size(); ++i) {
    mark[hs[i]]++;
  }
  for (int i = 0; i < ts.size(); ++i) {
    mark[ts[i]]--;
  }
  for (int i = 0; i < hs.size() && heads.size() < h; ++i) {
    if (mark[hs[i]] == 1 && hs[i] != v) {
      heads.push_back(hs[i]);
    }
  }
  for (int i = 0; i < ts.size() && tails.size() < t; ++i) {
    if (mark[ts[i]] == -1 && ts[i] != u) {
      tails.push_back(ts[i]);
    }
  }
  for (int i = 0; i < hs.size() && heads.size() < h; ++i) {
    if (mark[hs[i]] == 0) {
      mark[hs[i]] = 1;
      heads.push_back(hs[i]);
    }
  }
  for (int i = 0; i < ts.size() && tails.size() < t; ++i) {
    if (mark[ts[i]] == 0) {
      mark[ts[i]] = 1;
      tails.push_back(ts[i]);
    }
  }
  return heads.size() == h && tails.size() == t;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &h, &t);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &b[i], &e[i]);
    G[b[i]].push_back(e[i]);
    G[e[i]].push_back(b[i]);
    deg[e[i]]++;
    deg[b[i]]++;
  }
  for (int i = 0; i < m; ++i) {
    if (can(b[i], e[i])) {
      puts("YES");
      printf("%d %d\n", b[i], e[i]);
      for (int j = 0; j < h; ++j) {
        printf("%d ", heads[j]);
      }
      puts("");
      for (int j = 0; j < t; ++j) {
        printf("%d ", tails[j]);
      }
      puts("");
      return 0;
    }
    swap(e[i], b[i]);
    if (can(b[i], e[i])) {
      puts("YES");
      printf("%d %d\n", b[i], e[i]);
      for (int j = 0; j < h; ++j) {
        printf("%d ", heads[j]);
      }
      puts("");
      for (int j = 0; j < t; ++j) {
        printf("%d ", tails[j]);
      }
      puts("");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
