#include <bits/stdc++.h>
using namespace std;
int f[100010][21];
set<int> st;
vector<int> vt[100010];
int a[100010], b[100019];
int main() {
  int n, m, h, t;
  scanf("%d%d%d%d", &n, &m, &h, &t);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    vt[x].push_back(y);
    vt[y].push_back(x);
    a[i] = x, b[i] = y;
  }
  for (int i = 1; i <= n; i++) sort(vt[i].begin(), vt[i].end());
  for (int i = 0; i < m; i++) {
    int x = a[i], y = b[i];
    vector<int> A, B, C;
    for (int sa = 0, sb = 0; sa < min((int((vt[x]).size())), 210) ||
                             sb < min((int((vt[y]).size())), 210);) {
      if (sa < (int((vt[x]).size())) && vt[x][sa] == y) {
        sa++;
        continue;
      }
      if (sb < (int((vt[y]).size())) && vt[y][sb] == x) {
        sb++;
        continue;
      }
      if (sa < min((int((vt[x]).size())), 210) &&
          sb < min((int((vt[y]).size())), 210)) {
        if (vt[x][sa] == vt[y][sb])
          C.push_back(vt[x][sa]), sa++, sb++;
        else if (vt[x][sa] < vt[y][sb])
          A.push_back(vt[x][sa]), sa++;
        else
          B.push_back(vt[y][sb]), sb++;
      } else if (sa < min((int((vt[x]).size())), 210))
        A.push_back(vt[x][sa]), sa++;
      else
        B.push_back(vt[y][sb]), sb++;
    }
    for (int k = 0; k < 2; k++) {
      if (k) swap(x, y), swap(A, B);
      if ((int((A).size())) >= h && (int((B).size())) >= t) {
        cout << "YES\n";
        cout << x << " " << y << endl;
        for (int j = 0; j < h; j++) cout << A[j] << " ";
        cout << endl;
        for (int j = 0; j < t; j++) cout << B[j] << " ";
        cout << endl;
        return 0;
      }
      if ((int((A).size())) >= h) {
        if ((int((B).size())) + (int((C).size())) >= t) {
          cout << "YES\n";
          cout << x << " " << y << endl;
          for (int j = 0; j < h; j++) cout << A[j] << " ";
          cout << endl;
          for (int j = 0; j < (int((B).size())); j++) cout << B[j] << " ";
          for (int j = 0; j < t - int((int((B).size()))); j++)
            cout << C[j] << " ";
          cout << endl;
          return 0;
        } else
          continue;
      }
      if ((int((B).size())) >= t) {
        if ((int((A).size())) + (int((C).size())) >= h) {
          cout << "YES\n";
          cout << x << " " << y << endl;
          for (int j = 0; j < (int((A).size())); j++) cout << A[j] << " ";
          for (int j = 0; j < h - ((int((A).size()))); j++) cout << C[j] << " ";
          cout << endl;
          for (int j = 0; j < t; j++) cout << B[j] << " ";
          cout << endl;
          return 0;
        } else
          continue;
      }
      if ((int((A).size())) + (int((B).size())) + (int((C).size())) >= t + h) {
        cout << "YES\n";
        cout << x << " " << y << endl;
        for (int j = 0; j < (int((A).size())); j++) cout << A[j] << " ";
        for (int j = 0; j < h - ((int((A).size()))); j++) cout << C[j] << " ";
        cout << endl;
        for (int j = 0; j < (int((B).size())); j++) cout << B[j] << " ";
        for (int j = 0; j < t - ((int((B).size()))); j++)
          cout << C[j + h - (int((A).size()))] << " ";
        cout << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
