#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int maxn = 2e5 + 10;
int n, m;
vector<int> g[maxn];
bool bad[maxn];
int depth[maxn];
int par[maxn];
int target;
void dfs(int at, int p = 0, int d = 0) {
  depth[at] = d;
  par[at] = p;
  for (int to : g[at]) {
    if (depth[to] == -1) {
      dfs(to, at, d + 1);
    } else if (depth[at] - depth[to] + 1 >= target) {
      cout << 2 << endl;
      cout << depth[at] - depth[to] + 1 << endl;
      int x = at;
      while (x != to) {
        cout << x << " ";
        x = par[x];
      }
      cout << to << endl;
      exit(0);
    }
  }
  if (!bad[at]) {
    for (int x : g[at]) {
      bad[x] = true;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(depth, -1, sizeof(depth));
  cin >> n >> m;
  target = (int)ceil(sqrt(n));
  while (target * target < n) target++;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    if (!bad[i]) {
      v.push_back(i);
    }
  }
  v.resize(target);
  assert((int)v.size() == target);
  cout << 1 << endl;
  for (int x : v) cout << x << " ";
  cout << endl;
  return 0;
}
