#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 100 + 10;
const int MAXH = 100 + 1;
vector<int> adj[MAXN];
vector<pair<int, int> > edge;
int mark[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, h, t;
  cin >> n >> m >> h >> t;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    edge.push_back(make_pair(u, v));
    edge.push_back(make_pair(v, u));
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int e = 0; e < edge.size(); e++) {
    int a = edge[e].first;
    int b = edge[e].second;
    if ((int)adj[a].size() - 1 < h or (int) adj[b].size() - 1 < t) continue;
    int c = 0;
    for (int i = 0; i < adj[a].size() and i < 2 * MAXH; i++)
      if (adj[a][i] != b) mark[adj[a][i]] = e + 1;
    for (int i = 0; i < adj[b].size() and i < 2 * MAXH; i++)
      if (mark[adj[b][i]] == e + 1) c++;
    if ((int)adj[a].size() - 1 + (int)adj[b].size() - 1 - c < h + t) continue;
    memset(mark, -1, sizeof mark);
    vector<int> aa, bb;
    for (int i = 0; i < adj[a].size(); i++) mark[adj[a][i]] = 1;
    for (int i = 0; i < adj[b].size(); i++)
      if (mark[adj[b][i]] != -1)
        mark[adj[b][i]] = 3;
      else
        mark[adj[b][i]] = 2;
    mark[a] = mark[b] = -1;
    for (int i = 1; i < MAXN; i++)
      if (mark[i] == 1)
        aa.push_back(i);
      else if (mark[i] == 2)
        bb.push_back(i);
    for (int i = 1; i < MAXN; i++)
      if (mark[i] == 3) {
        if (aa.size() < h)
          aa.push_back(i);
        else if (bb.size() < t)
          bb.push_back(i);
      }
    cout << "YES" << endl;
    cout << a << ' ' << b << endl;
    for (int i = 0; i < aa.size() and i < h; i++) cout << aa[i] << ' ';
    cout << endl;
    for (int i = 0; i < bb.size() and i < t; i++) cout << bb[i] << ' ';
    cout << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}
