#include <bits/stdc++.h>
using namespace std;
int n, m, sqrtn;
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], tsort;
int p[MAXN], lvl[MAXN];
bool used[MAXN];
void dfs(int v = 1, int pr = -1) {
  used[v] = 1;
  p[v] = pr;
  if (pr != -1)
    lvl[v] = lvl[pr] + 1;
  else
    lvl[v] = 1;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (used[to]) {
      if (lvl[to] > lvl[v] && lvl[to] - lvl[v] + 1 >= sqrtn) {
        cout << "2\n";
        cout << lvl[to] - lvl[v] + 1 << '\n';
        while (to != v) {
          cout << to << ' ';
          to = p[to];
        }
        cout << v;
        exit(0);
      }
    } else
      dfs(to, v);
  }
  tsort.push_back(v);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  while (sqrtn * sqrtn < n) sqrtn++;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs();
  memset(used, 0, sizeof(used));
  int ptr = 0;
  vector<int> ans;
  for (int i = 0; ptr < sqrtn; ++i) {
    if (used[tsort[i]]) continue;
    ans.push_back(tsort[i]);
    for (int j = 0; j < g[tsort[i]].size(); ++j) used[g[tsort[i]][j]] = 1;
    ptr++;
  }
  cout << "1\n";
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << ' ';
  return 0;
}
