#include <bits/stdc++.h>
using namespace std;
const long long M = 1e5 + 10;
long long rem[M], n, m, sqc, mark[M], dep[M];
vector<long long> lst, g[M];
void dfs(long long v) {
  mark[v] = true;
  lst.push_back(v);
  dep[v] = lst.size();
  for (auto u : g[v])
    if (!mark[u])
      dfs(u);
    else if (dep[v] - dep[u] + 1 >= sqc) {
      cout << 2 << endl << dep[v] - dep[u] + 1 << endl;
      for (long long i = dep[v] - 1; i >= dep[u] - 1; i--)
        cout << lst[i] << " ";
      exit(0);
    }
  if (!rem[v])
    for (auto u : g[v]) rem[u] = true;
  lst.pop_back();
}
int32_t main() {
  cin >> n >> m;
  while (m--) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  sqc = sqrt(n);
  if (sqc * sqc < n) sqc++;
  dfs(1);
  cout << 1 << endl;
  for (long long i = 1; sqc; i++)
    if (!rem[i]) cout << i << " ", sqc--;
  return 0;
}
