#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> G[N];
int vis[N], n, m, h, t;
int check(int u, int v) {
  int num_h = 0, num_t = 0;
  for (int i = 1; i <= n; i++) {
    vis[i] = 0;
  }
  for (int i = 0; i < G[u].size(); i++) {
    vis[G[u][i]] = u;
    num_h++;
  }
  vis[v] = -1;
  num_h--;
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i] != u) {
      if (vis[G[v][i]] != u) {
        num_t++;
        vis[G[v][i]] = v;
      }
    }
  }
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i] != u) {
      if (vis[G[v][i]] == u && num_h > h) {
        num_t++;
        num_h--;
        vis[G[v][i]] = v;
      }
    }
  }
  if (num_h >= h && num_t >= t) {
    printf("YES\n");
    printf("%d %d\n", u, v);
    for (int i = 0; i < G[u].size(); i++) {
      if (vis[G[u][i]] == u) {
        printf("%d ", G[u][i]);
        h--;
      }
      if (h == 0) break;
    }
    printf("\n");
    for (int i = 0; i < G[v].size(); ++i) {
      if (vis[G[v][i]] == v && G[v][i] != u) {
        printf("%d ", G[v][i]);
        t--;
      }
      if (t == 0) break;
    }
    printf("\n");
    return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &h, &t);
  int u, v;
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (G[i].size() > h) {
      for (int j = 0; j < G[i].size(); j++) {
        v = G[i][j];
        if (G[v].size() > t) {
          if (check(i, v)) return 0;
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}
