#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, h[200005], fa[200005], w[200005], X, l1, l2, r1, r2, t,
    d[200005];
vector<int> v[200005];
void dfs(int x, int y) {
  h[x] = h[y] + 1;
  fa[x] = y;
  for (int i = 0; i < (int)v[x].size(); ++i) {
    if (!h[v[x][i]])
      dfs(v[x][i], x);
    else if (h[v[x][i]] < h[x] && v[x][i] != y)
      --w[v[x][i]], ++w[x];
  }
  w[y] += w[x];
}
void fly(int x, int y) {
  for (int i = 0; i < (int)v[x].size(); i++) {
    int go = v[x][i];
    if (h[go] == h[x] + 1) {
      fly(go, x);
      if (l2) return;
    } else if (h[go] < h[X] && go != y) {
      if (l1)
        r2 = x, l2 = go;
      else
        r1 = x, l1 = go;
      if (l2) return;
    }
  }
}
void add(int l, int r) {
  int k = t;
  t += abs(h[r] - h[l]) + 1;
  if (h[l] > h[r]) {
    for (int i = l, j = k + 1; j <= t; i = fa[i], j++) d[j] = i;
  } else {
    for (int i = r, j = t; j > k; i = fa[i], j--) d[j] = i;
  }
}
void P() {
  printf("%d ", t);
  for (int i = 1; i <= t; i++) printf("%d ", d[i]);
  printf("\n");
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (h[i] == 0) dfs(i, 0);
  }
  for (int i = 1; i <= n; i++) {
    if (w[i] > 1) X = i;
  }
  if (X == 0) {
    printf("NO\n");
    return 0;
  }
  fly(X, fa[X]);
  printf("YES\n");
  if (h[l1] > h[l2]) {
    swap(l1, l2);
    swap(r1, r2);
  }
  int ii, jj;
  for (ii = r1, jj = r2; ii != jj;) {
    if (h[ii] > h[jj])
      ii = fa[ii];
    else
      jj = fa[jj];
  }
  t = 0;
  add(ii, r1);
  add(l1, l2);
  P();
  t = 0;
  add(ii, r2);
  add(l2, l2);
  P();
  t = 0;
  add(ii, l2);
  P();
  return 0;
}
