#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
vector<int> adj[MAXN];
int mark[MAXN];
pair<int, int> hd[MAXN];
int main() {
  int n, m, h, t;
  scanf("%d%d%d%d", &n, &m, &h, &t);
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int u = 1; u <= n; ++u) {
    if (adj[u].size() < h + 1) continue;
    for (int i = 0; i < adj[u].size(); ++i) mark[adj[u][i]] = u;
    for (int X = 0; X < adj[u].size(); ++X) {
      int v = adj[u][X];
      if (adj[v].size() < t + 1) continue;
      vector<int> heads, tails, both;
      pair<int, int> CE = make_pair(u, v);
      for (int i = 0; i < adj[v].size() && i < h + t && tails.size() < t; ++i)
        if (adj[v][i] != u and mark[adj[v][i]] != u)
          tails.push_back(adj[v][i]);
        else if (adj[v][i] != u) {
          both.push_back(adj[v][i]);
          hd[adj[v][i]] = CE;
        }
      for (int i = 0; i < adj[u].size() && i < h + t && heads.size() < h; ++i)
        if (adj[u][i] != v && hd[adj[u][i]] != CE) heads.push_back(adj[u][i]);
      if (heads.size() + both.size() >= h and
          tails.size() + both.size() >= t and
          heads.size() + tails.size() + both.size() >= h + t) {
        cout << "YES" << endl;
        cout << u << " " << v << endl;
        while (h--)
          if (heads.size() != 0) {
            cout << heads[heads.size() - 1] << " ";
            heads.pop_back();
          } else {
            cout << both[both.size() - 1] << " ";
            both.pop_back();
          }
        cout << endl;
        while (t--)
          if (tails.size() != 0) {
            cout << tails[tails.size() - 1] << " ";
            tails.pop_back();
          } else {
            cout << both[both.size() - 1] << " ";
            both.pop_back();
          }
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
