#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INF64 = 1e18;
const long long MOD = 998244353;
const long double EPS = 1e-9;
const long double PI = acosl(-1.0);
void fileio() {}
const int N = 1e5 + 10;
int n, m, h, t;
vector<int> g[N];
vector<pair<long long, long long> > edges;
bool fl = false;
void check(int u, int v) {
  if (g[u].size() < h + 1 || g[v].size() < t + 1) return;
  vector<char> used(n, '0');
  for (int i = 0; i < int(g[u].size()); i++) {
    int to = g[u][i];
    if (to != v && used[to] == '0') used[to] = '1';
  }
  for (int i = 0; i < int(g[v].size()); i++) {
    int to = g[v][i];
    if (to != u) {
      if (used[to] == '0')
        used[to] = '2';
      else
        used[to] = '3';
    }
  }
  vector<char> ans(n, '0');
  int th = 0;
  int tt = 0;
  for (int i = 0; i < int(n); i++)
    if (used[i] == '1' && th < h) {
      th++;
      ans[i] = '1';
    } else if (used[i] == '2' && tt < t) {
      tt++;
      ans[i] = '2';
    }
  for (int i = 0; i < int(n); i++)
    if (used[i] == '3') {
      if (th < h) {
        th++;
        ans[i] = '1';
      } else if (tt < t) {
        tt++;
        ans[i] = '2';
      }
    }
  if (th < h || tt < t) return;
  fl = true;
  cout << "YES\n" << u + 1 << ' ' << v + 1 << "\n";
  for (int i = 0; i < int(n); i++)
    if (ans[i] == '1') cout << i + 1 << ' ';
  cout << "\n";
  for (int i = 0; i < int(n); i++)
    if (ans[i] == '2') cout << i + 1 << ' ';
  cout << "\n";
}
int main() {
  fileio();
  cin >> n >> m >> h >> t;
  for (int i = 0; i < int(m); i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
    edges.push_back(make_pair(u, v));
  }
  for (int i = 0; i < int(m); i++) {
    if (fl) break;
    int u = edges[i].first;
    int v = edges[i].second;
    check(u, v);
    if (fl) break;
    check(v, u);
  }
  if (!fl) cout << "NO\n";
}
