#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m;
int uzet[MAXN];
int bio[MAXN];
int dis[MAXN], tajm;
int trea;
vector<int> v[MAXN];
vector<int> ind, tmp;
int poz[MAXN];
void dfs(int cvor, int par) {
  poz[cvor] = (int)tmp.size();
  tmp.push_back(cvor);
  bio[cvor] = 1;
  int cnt = -1, last = -1;
  for (auto ncvor : v[cvor]) {
    if (ncvor == par) continue;
    if (bio[ncvor] == 2) continue;
    if (bio[ncvor] == 1) {
      if (poz[cvor] - poz[ncvor] >= trea - 1) {
        cnt = trea;
        last = ncvor;
      }
      continue;
    }
    dfs(ncvor, cvor);
  }
  if (cnt >= trea - 1) {
    vector<int> ans;
    bool ok = 0;
    puts("2");
    for (auto x : tmp) {
      if (x == last) ok = 1;
      if (ok) ans.push_back(x);
    }
    printf("%d\n", (int)ans.size());
    for (auto x : ans) printf("%d ", x);
    puts("");
    exit(0);
  }
  if (!uzet[cvor]) {
    ind.push_back(cvor);
    for (auto ncvor : v[cvor]) uzet[ncvor] = 1;
    uzet[cvor] = 1;
  }
  tmp.pop_back();
  bio[cvor] = 2;
}
int main() {
  scanf("%d %d", &n, &m);
  trea = sqrt(n);
  if (trea * trea != n) trea++;
  for (int i = (0); i < int(m); i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = (1); i < int(n + 1); i++) {
    if (!bio[i]) dfs(i, -1);
  }
  puts("1");
  for (int i = (0); i < int(trea); i++) printf("%d ", ind[i]);
  puts("");
  return 0;
}
