#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
int no, ed, h, t;
vector<vector<int> > adj;
int H[101], T[101], C[401];
void sol() {
  for (int i = 0; i < no; i++) {
    sort(adj[i].begin(), adj[i].end());
  }
  for (int i = 0; i < no; i++) {
    for (int j = 0; j < (int)(adj[i].size()); j++) {
      int x = i, y = adj[i][j];
      int l = 0, ll = 0;
      int a = 0, b = 0, c = 0;
      while (l < (int)(adj[x].size()) && ll < (int)(adj[y].size())) {
        if (adj[x][l] != y && adj[y][ll] != x) {
          if (adj[x][l] < adj[y][ll]) H[a] = adj[x][l], a++, l++;
          if (adj[x][l] > adj[y][ll]) T[b] = adj[y][ll], b++, ll++;
          if (adj[x][l] == adj[y][ll]) {
            C[c] = adj[x][l];
            l++, ll++, c++;
          }
        } else {
          if (adj[x][l] == y) l++;
          if (adj[y][ll] == x) ll++;
        }
        if (l == (int)(adj[x].size()) || a == h) {
          while (ll < (int)(adj[y].size()) && b < t) {
            if (adj[y][ll] == x) {
              ll++;
              continue;
            }
            T[b] = adj[y][ll];
            b++, ll++;
          }
        }
        if (ll == (int)(adj[y].size()) || b == t) {
          while (l < (int)(adj[x].size()) && a < h) {
            if (adj[x][l] == y) {
              l++;
              continue;
            }
            H[a] = adj[x][l];
            a++, l++;
          }
        }
        if (a == h || b == t || c > 200) break;
      }
      if (h - a + t - b <= c) {
        printf("YES\n%d %d\n", x + 1, y + 1);
        for (l = 0; l < a; l++) printf("%d ", H[l] + 1);
        for (ll = 0; ll < h - a; ll++) printf("%d ", C[ll] + 1);
        printf("\n");
        for (l = 0; l < b; l++) printf("%d ", T[l] + 1);
        for (l = ll; l < (t - b) + ll; l++) printf("%d ", C[l] + 1);
        printf("\n");
        return;
      }
    }
  }
  printf("NO\n");
}
int main() {
  scanf("%d %d %d %d\n", &no, &ed, &h, &t);
  adj.resize(no);
  for (int i = 0; i < ed; i++) {
    int x, y;
    scanf("%d %d\n", &x, &y);
    adj[x - 1].push_back(y - 1);
    adj[y - 1].push_back(x - 1);
  }
  sol();
  return 0;
}
