#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 1, mod = 1e9 + 7, inf = 2e9;
int n, m, s, h[N], par[N];
vector<int> adj[N];
bool c[N];
void dfs(int v, int p = 0) {
  par[v] = p;
  for (auto u : adj[v]) {
    if (u == p) {
      continue;
    }
    if (h[u] == 0) {
      h[u] = h[v] + 1;
      dfs(u, v);
    } else if (h[u] < h[v]) {
      int ans = h[v] - h[u] + 1;
      if (ans >= s) {
        cout << "2\n" << ans << '\n';
        while (h[v] >= h[u]) {
          cout << v << ' ';
          v = par[v];
        }
        exit(0);
      }
    }
  }
  if (!c[v]) {
    for (auto u : adj[v]) {
      c[u] = 1;
    }
  }
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> m;
  s = ceil(sqrt(n));
  for (int i = 1, u, v; i <= m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  h[1] = 1;
  dfs(1);
  cout << "1\n";
  for (int i = 1; s; i++) {
    if (!c[i]) {
      cout << i << ' ';
      s--;
    }
  }
}
