#include <bits/stdc++.h>
using namespace std;
int n, m, nrh, nrt, nod1, nod2, d[100006], x, nr1, nr2, nra;
vector<int> G[100006];
vector<int> sters;
int uz[100006], uz2[100006];
int main() {
  int i, j, k;
  cin >> n >> m >> nrh >> nrt;
  for (i = 1; i <= m; i++) {
    cin >> nod1 >> nod2;
    G[nod1].push_back(nod2);
    G[nod2].push_back(nod1);
    d[nod1]++;
    d[nod2]++;
  }
  for (i = 1; i <= n; i++)
    if (d[i] > nrh) uz[i] = 1;
  for (i = 1; i <= n; i++) {
    if (d[i] > nrt) {
      for (j = 0; j < G[i].size(); j++) {
        if (uz[G[i][j]]) {
          nra = nr1 = nr2 = 0;
          x = G[i][j];
          for (k = 0; k < G[i].size(); k++) {
            if (k != j) {
              uz2[G[i][k]]++;
              nr1++;
              sters.push_back(G[i][k]);
            }
          }
          for (k = 0; k < G[x].size(); k++) {
            if (G[x][k] != i) {
              uz2[G[x][k]]++;
              if (uz2[G[x][k]] == 2)
                nra++;
              else
                sters.push_back(G[x][k]);
              nr2++;
            }
          }
          if (nr1 + nr2 - nra < nrt + nrh) {
            for (k = 0; k < sters.size(); k++) uz2[sters[k]] = 0;
            sters.clear();
            continue;
          }
          cout << "YES\n";
          cout << G[i][j] << ' ' << i << '\n';
          for (k = 0; k < G[x].size() && nrh; k++) {
            if (uz2[G[x][k]] == 1) {
              cout << G[x][k] << ' ';
              nrh--;
            }
          }
          for (k = 0; nrh; k++) {
            if (uz2[G[x][k]] == 2) {
              uz2[G[x][k]] = 0;
              cout << G[x][k] << ' ';
              nrh--;
            }
          }
          cout << '\n';
          for (k = 0; k < G[i].size() && nrt; k++) {
            if (uz2[G[i][k]]) {
              cout << G[i][k] << ' ';
              nrt--;
            }
          }
          return 0;
        }
      }
    }
  }
  cout << "NO\n";
  return 0;
}
