#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
int n, m;
vector<int> G[max_n];
bool vis[max_n];
int dep[max_n];
bool mark[max_n];
vector<int> stk;
int B;
void dfs(int u, int fa) {
  vis[u] = true;
  stk.push_back(u);
  for (auto v : G[u]) {
    if (v == fa) continue;
    if (!vis[v]) {
      dep[v] = dep[u] + 1;
      dfs(v, u);
    } else {
      if (dep[u] - dep[v] + 1 >= B) {
        printf("2\n");
        printf("%d\n", dep[u] - dep[v] + 1);
        while (1) {
          printf("%d ", stk.back());
          if (stk.back() == v) {
            printf("\n");
            exit(0);
          }
          stk.pop_back();
        }
      }
    }
  }
  if (!mark[u]) {
    for (auto v : G[u]) mark[v] = true;
  }
  stk.pop_back();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  B = sqrt(n);
  while (B * B < n) B++;
  dfs(1, 0);
  printf("1\n");
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      printf("%d ", i);
      B--;
      if (B == 0) {
        printf("\n");
        return 0;
      }
    }
  }
}
