#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
vector<long long> g[N];
long long par[N], h[N];
long long w = 0;
bool used[N];
void dfs(long long u, long long p) {
  used[u] = 1;
  par[u] = p;
  for (long long v : g[u]) {
    if (!used[v]) {
      h[v] = h[u] + 1;
      dfs(v, u);
    } else {
      if (h[u] - h[v] + 1 >= w) {
        cout << 2 << endl;
        cout << h[u] - h[v] + 1 << endl;
        long long t = u;
        while (1) {
          cout << t << ' ';
          if (t == v) break;
          t = par[t];
        }
        cout << endl;
        exit(0);
      }
    }
  }
}
vector<long long> r[N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; ++i) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  while (w * w < n) ++w;
  dfs(1, 1);
  cout << 1 << '\n';
  vector<long long> ans;
  for (long long i = 1; i <= n; ++i) r[h[i] % (w - 1)].push_back(i);
  for (long long i = 0; i < N; ++i)
    if (r[i].size() >= w) {
      for (long long j = 0; j < w; ++j) cout << r[i][j] << ' ';
      cout << '\n';
      exit(0);
    }
}
