#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int llINF = (long long)(1e18) + 100;
const int MAXN = 1e5 + 10;
int N;
int n, m, is[MAXN], hgt[MAXN];
vector<int> adj[MAXN], seq;
void dfs(int v) {
  seq.push_back(v);
  hgt[v] = seq.size();
  for (int x : adj[v]) {
    if (hgt[x] == 0)
      dfs(x);
    else if (hgt[v] - hgt[x] + 1 >= N) {
      cout << 2 << '\n';
      cout << hgt[v] - hgt[x] + 1 << '\n';
      for (int i = hgt[x] - 1; i < hgt[v]; i++) cout << seq[i] << ' ';
      cout << '\n';
      exit(0);
    }
  }
  if (!is[v]) {
    for (int x : adj[v]) is[x] = 1;
  }
  seq.pop_back();
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  while (N * N < n) N++;
  dfs(1);
  cout << 1 << '\n';
  for (int i = 1; i <= n; i++)
    if (!is[i] and N) {
      cout << i << ' ';
      N--;
    }
  cout << '\n';
}
