#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
vector<pair<int, int> > o;
vector<int> g[N], oo, ans;
bool mark[N];
int h[N], par[N];
pair<int, int> big[N];
void print(bool rever) {
  if (rever) reverse(ans.begin(), ans.end());
  printf("%d ", ans.size());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i] + 1);
  printf("\n");
  ans.clear();
}
void add(int S, int E) {
  ans.push_back(S);
  while (S != E) {
    S = par[S];
    ans.push_back(S);
  }
}
void print1(int S, int E, int down, int up) {
  add(S, E);
  print(false);
  ans.push_back(S);
  ans.push_back(E);
  print(false);
  add(E, up);
  add(down, S);
  print(true);
}
void print2(int S, int E, int down, int up) {
  add(S, E);
  print(false);
  add(E, up);
  ans.push_back(S);
  print(true);
  ans.push_back(E);
  add(down, S);
  print(true);
}
void print3(int S, int E, int downL, int downR, int up) {
  add(S, E);
  print(false);
  add(E, up);
  add(downL, S);
  print(true);
  ans.push_back(E);
  add(downR, S);
  print(true);
}
void print4(int S, int E, int downL, int downR, int up) {
  add(S, E);
  print(false);
  ans.push_back(E);
  add(downL, S);
  print(true);
  add(E, up);
  add(downR, S);
  print(true);
}
void dfs(int v, int depth) {
  mark[v] = true;
  h[v] = depth;
  big[v] = make_pair(-1, -1);
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (mark[u] && h[u] < h[v] - 1) {
      if (o.size() && h[u] < h[o.back().first]) {
        printf("YES\n");
        if (h[u] <= h[o.back().second])
          print1(o.back().first, o.back().second, v, u);
        else
          print2(o.back().first, u, v, o.back().second);
        exit(0);
      }
      if (oo.size() && h[u] < h[oo.back()]) {
        printf("YES\n");
        int S = oo.back();
        int downL = big[S].second;
        ;
        int fl = big[S].first;
        if (h[fl] <= h[u])
          print3(oo.back(), u, downL, v, fl);
        else
          print4(oo.back(), fl, downL, v, u);
        exit(0);
      }
      o.push_back(make_pair(v, u));
      if (big[v].first == -1 || h[big[v].first] > h[u])
        big[v] = make_pair(u, v);
    }
  }
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (!mark[u]) {
      bool added = false;
      if (big[v].first != -1) {
        oo.push_back(v);
        added = true;
      }
      par[u] = v;
      dfs(u, depth + 1);
      if (added) oo.pop_back();
      if (big[u].first == -1) continue;
      if ((big[v].first == -1 && h[big[u].first] < h[v]) ||
          h[big[u].first] < h[big[v].first])
        big[v] = big[u];
    }
  }
  while (o.size() && o.back().first == v) o.pop_back();
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (!mark[i]) dfs(i, 0);
  printf("NO\n");
}
