#include <bits/stdc++.h>
using namespace std;
void ASS(bool bb) {
  if (!bb) {
    ++*(int*)0;
  }
}
#pragma comment(linker, "/STACK:106777216")
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
const int N = 1 << 17;
vector<int> g[N];
void W(const vector<int>& v) {
  for (int i = 0; i < (int)(v.size()); i++) {
    if (i) cout << " ";
    cout << (v[i] + 1);
  }
  cout << endl;
}
int f[N];
int main() {
  int n = read();
  int m = read();
  int h = read();
  int t = read();
  for (int i = 0; i < (int)(m); i++) {
    int x = read() - 1;
    int y = read() - 1;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i < (int)(n); i++)
    if (g[i].size() >= h + 1) {
      vector<int> va;
      for (int k = 0; k < (int)(g[i].size()); k++) {
        va.push_back(g[i][k]);
        if (va.size() > h + t) break;
      }
      sort(va.begin(), va.end());
      for (int j = 0; j < (int)(va.size()); j++) f[va[j]] = i + 1;
      for (int k = 0; k < (int)(g[i].size()); k++) {
        int j = g[i][k];
        int vaCont = binary_search(va.begin(), va.end(), j);
        vector<int> vb;
        vector<int> vab;
        for (int z = 0; z < (int)(g[j].size()); z++) {
          int x = g[j][z];
          if (x != i) {
            if (f[x] == i + 1)
              vab.push_back(x);
            else
              vb.push_back(x);
          }
          if (vb.size() >= t ||
              min((int)va.size() - vaCont - h, (int)vab.size()) + vb.size() >=
                  t) {
            cout << "YES" << endl;
            cout << (i + 1) << " " << (j + 1) << endl;
            vector<int> bad(N, 0);
            bad[j] = 1;
            while (vb.size() < t) {
              vb.push_back(vab.back());
              bad[vab.back()] = 1;
              vab.pop_back();
            }
            vector<int> a;
            for (int d = 0; d < (int)(va.size()); d++) {
              if (!bad[va[d]]) a.push_back(va[d]);
              if (a.size() == h) break;
            }
            W(a);
            W(vb);
            return 0;
          }
        }
      }
    }
  cout << "NO" << endl;
  return 0;
}
