#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> G[N];
vector<int> ind[N];
vector<int> stk;
bool vis[N];
int deep[N];
int sq;
void dfs(int u, int fa, int dp) {
  vis[u] = true;
  stk.push_back(u);
  ind[dp % (sq - 1)].push_back(u);
  deep[u] = dp;
  for (int v : G[u]) {
    if (v != fa) {
      if (vis[v] && deep[u] - deep[v] + 1 >= sq) {
        int cur;
        printf("%d\n%d\n", 2, deep[u] - deep[v] + 1);
        do {
          cur = stk.back();
          if (stk.empty()) exit(-1);
          stk.pop_back();
          printf("%d ", cur);
        } while (cur != v);
        exit(0);
      } else if (!vis[v])
        dfs(v, u, dp + 1);
    }
  }
  stk.pop_back();
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  sq = sqrt(n);
  while (sq * sq < n) sq++;
  dfs(1, 0, 0);
  printf("1\n");
  for (int i = 1; i <= n; i++) {
    int x = deep[i];
    if (ind[x].size() >= sq) {
      for (int j = 0; j < sq; j++) {
        printf("%d ", ind[x][j]);
      }
      return 0;
    }
  }
}
