#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::istream &operator>>(std::istream &i, pair<T, U> &p) {
  i >> p.first >> p.second;
  return i;
}
template <typename T>
std::istream &operator>>(std::istream &i, vector<T> &t) {
  for (auto &v : t) {
    i >> v;
  }
  return i;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &o, const pair<T, U> &p) {
  o << p.first << ' ' << p.second;
  return o;
}
template <typename T>
std::ostream &operator<<(std::ostream &o, const vector<T> &t) {
  if (t.empty()) o << '\n';
  for (size_t i = 0; i < t.size(); ++i) {
    o << t[i] << " \n"[i == t.size() - 1];
  }
  return o;
}
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
bool in(T a, T b, T c) {
  return a <= b && b < c;
}
unsigned int logceil(int first) {
  return 8 * sizeof(int) - __builtin_clz(first);
}
namespace std {
template <typename T, typename U>
struct hash<pair<T, U>> {
  hash<T> t;
  hash<U> u;
  size_t operator()(const pair<T, U> &p) const {
    return t(p.first) ^ (u(p.second) << 7);
  }
};
}  // namespace std
template <typename T, typename F>
T bsh(T l, T h, const F &f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      l = m + 1;
      r = m;
    } else {
      h = m - 1;
    }
  }
  return r;
}
template <typename F>
double bshd(double l, double h, const F &f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      l = m;
    } else {
      h = m;
    }
  }
  return (l + h) / 2;
}
template <typename T, typename F>
T bsl(T l, T h, const F &f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      h = m - 1;
      r = m;
    } else {
      l = m + 1;
    }
  }
  return r;
}
template <typename F>
double bsld(double l, double h, const F &f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      h = m;
    } else {
      l = m;
    }
  }
  return (l + h) / 2;
}
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
template <typename T>
class vector2 : public vector<vector<T>> {
 public:
  vector2() {}
  vector2(size_t a, size_t b, T t = T())
      : vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T>
class vector3 : public vector<vector2<T>> {
 public:
  vector3() {}
  vector3(size_t a, size_t b, size_t c, T t = T())
      : vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T>
class vector4 : public vector<vector3<T>> {
 public:
  vector4() {}
  vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
      : vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T>
class vector5 : public vector<vector4<T>> {
 public:
  vector5() {}
  vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
      : vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
struct Graph {
  explicit Graph(const vector<vector<int>> &E) : E(E), N(E.size()) {}
  void prep_dfs() {
    D = P = vector<int>(N, 0);
    T = 0;
  }
  void bridges(vector<std::pair<int, int>> &br) {
    prep_dfs();
    for (int i = 0; i < N; i++)
      if (!D[i]) _bridge_dfs(br, i);
  }
  int _bridge_dfs(vector<std::pair<int, int>> &br, int u) {
    int top = D[u] = ++T;
    for (int v : E[u]) {
      if (!D[v]) {
        P[v] = u;
        int up = _bridge_dfs(br, v);
        top = min(top, up);
        if (up > D[u]) br.push_back({u, v});
      } else if (P[u] != v)
        top = min(top, D[v]);
    }
    return top;
  }
  bool bicon(const function<bool(vector<std::pair<int, int>>::iterator,
                                 vector<std::pair<int, int>>::iterator)> &f) {
    prep_dfs();
    vector<std::pair<int, int>> s;
    for (int i = 0; i < N; i++) {
      if (D[i]) continue;
      if (_bicon_dfs(i, s, f) == -1) return true;
      if (!s.empty()) {
        if (f(s.begin(), s.end())) return true;
        s.erase(s.begin(), s.end());
      }
    }
    return false;
  }
  int _bicon_dfs(
      int u, vector<std::pair<int, int>> &s,
      const function<bool(vector<std::pair<int, int>>::iterator,
                          vector<std::pair<int, int>>::iterator)> &f) {
    int c = 0, top = D[u] = ++T;
    for (int v : E[u]) {
      if (!D[v]) {
        P[v] = u;
        int r = s.size();
        s.push_back({u, v});
        int up = _bicon_dfs(v, s, f);
        if (up == -1) return -1;
        top = min(top, up);
        if ((D[u] == 1 && ++c > 1) || (D[u] != 1 && up >= D[u])) {
          if (f(s.begin() + r, s.end())) return -1;
          s.erase(s.begin() + r, s.end());
        }
      } else if (P[u] != v) {
        top = min(top, D[v]);
        if (D[v] < D[u]) s.push_back({u, v});
      }
    }
    return top;
  }
  void artic(vector<bool> &art) {
    prep_dfs();
    for (int i = 0; i < N; i++)
      if (!D[i]) _artic_dfs(art, i);
  }
  int _artic_dfs(vector<bool> &art, int u) {
    int top = D[u] = ++T, c = 0;
    art[u] = false;
    for (int v : E[u]) {
      if (!D[v]) {
        P[v] = u;
        int up = _artic_dfs(art, v);
        top = min(top, up);
        if ((D[u] == 1 && ++c > 1) || (D[u] != -1 && up >= D[u])) art[u] = true;
      } else if (P[u] != v)
        top = min(top, D[v]);
    }
    return top;
  }
  const vector<vector<int>> &E;
  int N, T;
  vector<int> P, D;
};
class TaskE {
 public:
  bool find_cycle(map<int, vector<int>> &E, int target, int cur,
                  vector<int> &path, set<int> &visited) {
    if (cur == target) return path.size() > 2;
    if (visited.find(cur) != visited.end()) return false;
    visited.insert(cur);
    path.push_back(cur);
    for (int q : E[cur]) {
      if (find_cycle(E, target, q, path, visited)) return true;
    }
    path.pop_back();
    return false;
  }
  bool find_path_to(map<int, vector<int>> &E, set<int> &target, int forbidden,
                    int cur, vector<int> &path, set<int> &visited) {
    if (cur == forbidden) return false;
    if (target.find(cur) != target.end()) {
      path.push_back(cur);
      return true;
    }
    if (visited.find(cur) != visited.end()) return false;
    path.push_back(cur);
    visited.insert(cur);
    for (int q : E[cur]) {
      if (find_path_to(E, target, forbidden, q, path, visited)) return true;
    }
    path.pop_back();
    return false;
  }
  void solve(istream &cin, ostream &cout) {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> E(N);
    for (int i = 0; i < M; ++i) {
      int u, v;
      cin >> u >> v;
      --u;
      --v;
      E[u].push_back(v);
      E[v].push_back(u);
    }
    Graph G(E);
    vector<vector<std::pair<int, int>>> B;
    bool found = false;
    auto lambda = [&](vector<std::pair<int, int>>::iterator b,
                      vector<std::pair<int, int>>::iterator e) {
      if (found) return false;
      map<int, vector<int>> edges;
      for (auto it = b; it != e; ++it) {
        edges[it->first].push_back(it->second);
        edges[it->second].push_back(it->first);
      }
      int source = -1;
      for (auto &q : edges)
        if (q.second.size() >= 3) {
          source = q.first;
          break;
        }
      if (source == -1) return false;
      vector<int> cycle{source};
      set<int> visited, targets;
      find_cycle(edges, source, edges[source][0], cycle, visited);
      for (int vertex : cycle) targets.insert(vertex);
      for (int nextNeighbor : edges[source]) {
        if (cycle[1] != nextNeighbor && cycle.back() != nextNeighbor &&
            !found) {
          vector<int> otherPath{source};
          visited.clear();
          find_path_to(edges, targets, source, nextNeighbor, otherPath,
                       visited);
          int target = otherPath.back();
          vector<int> P1, P2, P3;
          int p = 0;
          while (cycle[p] != target) P1.push_back(cycle[p++] + 1);
          P1.push_back(target + 1);
          while (p < cycle.size()) P2.push_back(cycle[p++] + 1);
          P2.push_back(source + 1);
          reverse(P2.begin(), P2.end());
          for (int &t : otherPath) P3.push_back(t + 1);
          cout << "YES\n";
          cout << P1.size() << ' ' << P1;
          cout << P2.size() << ' ' << P2;
          cout << P3.size() << ' ' << P3;
          return found = true;
        }
      }
      return false;
    };
    G.bicon(lambda);
    if (!found) {
      cout << "NO\n";
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  TaskE solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
