#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
vector<int> v[maxn], s;
int dep[maxn] = {0};
int vis[maxn] = {0};
int sq;
void dfs(int x) {
  s.push_back(x);
  dep[x] = s.size();
  for (auto y : v[x]) {
    if (!dep[y])
      dfs(y);
    else if (dep[x] - dep[y] + 1 >= sq) {
      cout << 2 << endl;
      cout << dep[x] - dep[y] + 1 << endl;
      for (int i = dep[y] - 1; i < dep[x]; i++) {
        cout << s[i] << " ";
      }
      cout << endl;
      exit(0);
    }
  }
  if (!vis[x]) {
    for (auto y : v[x]) vis[y] = 1;
  }
  s.pop_back();
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  sq = (int)ceil(sqrt(n));
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1);
  cout << 1 << endl;
  for (int i = 1; i <= n; i++) {
    if (!sq) break;
    if (!vis[i]) {
      cout << i << " ";
      sq--;
    }
  }
  return 0;
}
