#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
int n, m, dep[200050], fa[200050], cnt[200050], st, lb, ub, LB, UB;
vector<int> G[200050];
inline void dfs1(int u, int fa) {
  dep[u] = dep[fa] + 1;
  ::fa[u] = fa;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (v != fa) {
      if (!dep[v]) {
        dfs1(v, u);
        cnt[u] += cnt[v];
      } else if (dep[v] < dep[u]) {
        cnt[u]++;
        cnt[v]--;
      }
    }
  }
}
inline void dfs2(int u, int fa) {
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (v != fa) {
      if (dep[v] == dep[u] + 1)
        dfs2(v, u);
      else if (dep[v] < dep[st]) {
        if (!lb) {
          lb = u;
          ub = v;
        } else {
          LB = u;
          UB = v;
        }
      }
    }
    if (LB) break;
  }
}
int ans[200050], anscnt = 0, tmp[200050], tmpcnt = 0;
inline void GetAns(int u, int v) {
  if (dep[u] < dep[v]) {
    memset(tmp, 0, sizeof(tmp));
    tmpcnt = 0;
    v = fa[v];
    while (v != u) {
      tmp[++tmpcnt] = v;
      v = fa[v];
    }
    tmp[++tmpcnt] = u;
    reverse(tmp + 1, tmp + tmpcnt + 1);
    for (int i = 1; i <= tmpcnt; i++) ans[++anscnt] = tmp[i];
  } else {
    while (u != v) {
      ans[++anscnt] = u;
      u = fa[u];
    }
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!fa[i]) dfs1(i, 0);
  }
  for (int i = 1; i <= n && !st; i++) {
    if (cnt[i] > 1) st = i;
  }
  if (!st) {
    puts("NO");
    return 0;
  }
  puts("YES");
  dfs2(st, fa[st]);
  if (dep[UB] < dep[ub]) {
    swap(UB, ub);
    swap(LB, lb);
  }
  int x = lb, y = LB;
  while (x != y) {
    if (dep[x] > dep[y])
      x = fa[x];
    else
      y = fa[y];
  }
  GetAns(x, lb);
  ans[++anscnt] = lb;
  GetAns(ub, UB);
  ans[++anscnt] = UB;
  cout << anscnt << " ";
  for (int i = 1; i <= anscnt; i++) cout << ans[i] << " ";
  cout << endl;
  memset(ans, 0, sizeof(ans));
  anscnt = 0;
  GetAns(x, LB);
  ans[++anscnt] = LB;
  ans[++anscnt] = UB;
  cout << anscnt << " ";
  for (int i = 1; i <= anscnt; i++) cout << ans[i] << " ";
  cout << endl;
  memset(ans, 0, sizeof(ans));
  anscnt = 0;
  GetAns(x, UB);
  ans[++anscnt] = UB;
  cout << anscnt << " ";
  for (int i = 1; i <= anscnt; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
