#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 123;
const int mod = 1e9 + 7;
const int INF = 1e9 + 1;
const long long INFL = 3e18 + 1;
const double pi = acos(-1.0);
inline void DoBetter() {
  unsigned int FOR;
  asm("rdtsc" : "=a"(FOR));
  srand(FOR);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n, m, h, t, sz[N], u[N], v[N];
vector<int> g[N];
int main() {
  DoBetter();
  cin >> n >> m >> h >> t;
  for (int i = 1; i <= m; i++) {
    cin >> u[i] >> v[i];
    sz[u[i]]++;
    sz[v[i]]++;
    g[u[i]].push_back(v[i]);
    g[v[i]].push_back(u[i]);
  }
  bool was[n + 2], cmn[n + 2];
  memset(was, 0, sizeof was);
  memset(cmn, 0, sizeof cmn);
  for (int i = 1; i <= m + m; i++) {
    int x = u[i], y = v[i];
    if (i > m) {
      x = u[i - m], y = v[i - m];
      swap(x, y);
    }
    if (sz[x] < h + 1 || sz[y] < t + 1) continue;
    vector<int> Cmn, ans, ams;
    for (auto to : g[x]) was[to] = 1;
    for (auto to : g[y])
      if (was[to]) {
        cmn[to] = 1;
        Cmn.push_back(to);
      }
    for (auto to : g[x]) {
      if (cmn[to] || to == y) continue;
      ans.push_back(to);
      if (ans.size() == h) break;
    }
    for (auto to : g[y]) {
      if (cmn[to] || to == x) continue;
      ams.push_back(to);
      if (ams.size() == t) break;
    }
    bool fail = 0;
    while (ans.size() < h) {
      if (Cmn.size() == 0) {
        fail = 1;
        break;
      }
      ans.push_back(Cmn.back());
      Cmn.pop_back();
      if (ans.size() == h) break;
    }
    while (ams.size() < t) {
      if (Cmn.size() == 0) {
        fail = 1;
        break;
      }
      ams.push_back(Cmn.back());
      Cmn.pop_back();
      if (ams.size() == t) break;
    }
    if (fail) {
      memset(was, 0, sizeof was);
      memset(cmn, 0, sizeof cmn);
      continue;
    }
    cout << "YES" << endl << x << ' ' << y << endl;
    for (auto it : ans) cout << it << ' ';
    cout << endl;
    for (auto it : ams) cout << it << ' ';
    return 0;
  }
  cout << "NO";
  return 0;
}
