#include <bits/stdc++.h>
const int N = 2e5 + 6;
struct edge {
  int to, nxt;
  bool vis;
} e[N << 1];
int head[N], cnt = 1, n, m, dep[N], fa[N], up[N];
bool vis[N];
std::vector<int> out;
void O_R(int now, const int& ed) {
  if (now != ed) O_R(fa[now], ed);
  out.push_back(now);
}
void output() {
  printf("%d", out.size());
  for (int i = 0; i < out.size(); ++i) printf(" %d", out[i]);
  putchar('\n');
  out.clear();
}
void DFS(int now, int pre) {
  vis[now] = 1;
  for (int i = head[now]; i; i = e[i].nxt)
    if (i != pre && !vis[e[i].to]) {
      e[i].vis = 1;
      dep[e[i].to] = dep[now] + 1;
      fa[e[i].to] = now;
      DFS(e[i].to, i ^ 1);
    } else if (dep[e[i].to] < dep[now] && i != pre) {
      if (!up[now])
        up[now] = e[i].to;
      else {
        puts("YES");
        int u = up[now], v = e[i].to;
        if (dep[u] < dep[v]) u ^= v ^= u ^= v;
        out.push_back(now);
        for (int s = now; s != u; s = fa[s]) out.push_back(fa[s]);
        output();
        printf("2 %d %d\n", now, u);
        out.push_back(now);
        O_R(u, v);
        output();
        exit(0);
      }
    }
}
int dfs(int now) {
  int res = up[now] ? now : 0;
  for (int i = head[now]; i; i = e[i].nxt)
    if (e[i].vis) {
      int t = dfs(e[i].to);
      if (up[t] == now) t = 0;
      if (res && t) {
        int u = up[res], v = up[t];
        if (dep[u] < dep[v]) u ^= v ^= u ^= v, res ^= t ^= res ^= t;
        puts("YES");
        O_R(res, now), out.push_back(u);
        output();
        out.push_back(now);
        for (int s = now; s != u; s = fa[s]) out.push_back(fa[s]);
        output();
        O_R(t, now), O_R(u, v);
        output();
        exit(0);
      } else if (t)
        res = t;
    }
  return res;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    e[++cnt] = (edge){v, head[u]}, head[u] = cnt;
    e[++cnt] = (edge){u, head[v]}, head[v] = cnt;
  }
  for (int i = 1; i <= n; ++i)
    if (!dep[i]) dep[i] = 1, DFS(i, 0);
  for (int i = 1; i <= n; ++i)
    if (dep[i] == 1) dfs(i);
  puts("NO");
  return 0;
}
