#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> edge[maxn];
int dep[maxn], pre[maxn], lim;
bool mark[maxn];
void dfs(int u) {
  dep[u] = dep[pre[u]] + 1;
  for (auto v : edge[u]) {
    if (v == pre[u]) continue;
    if (!dep[v])
      pre[v] = u, dfs(v);
    else {
      if (dep[u] - dep[v] + 1 >= lim) {
        printf("2\n%d\n%d ", dep[u] - dep[v] + 1, u);
        int now = u;
        do {
          now = pre[now];
          printf("%d ", now);
        } while (now != v);
        exit(0);
      }
    }
  }
  if (!mark[u])
    for (auto v : edge[u]) mark[v] = 1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  lim = sqrt(n);
  while (lim * lim < n) lim++;
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  pre[1] = 0;
  dfs(1);
  printf("1\n");
  for (int i = 1; lim; i++) {
    if (!mark[i]) {
      printf("%d ", i);
      lim--;
    }
  }
  return 0;
}
