#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
constexpr int N = 1e5 + 5;
int n, m, a, b, height[N], par[N], cur = 0;
set<int> gr[N];
bool used[N];
vector<int> cyc;
void dfs(int v = 1, int p = -1) {
  par[v] = p;
  if (p == -1)
    height[v] = 1;
  else
    height[v] = height[p] + 1;
  for (int u : gr[v]) {
    if (u != p) {
      if (height[u] == 0)
        dfs(u, v);
      else if (cur < height[v] - height[u] + 1) {
        cur = height[v] - height[u] + 1;
        cyc.clear();
        cyc.push_back(u);
        cyc.push_back(v);
      }
    }
  }
}
void Solve() {
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    gr[a].insert(b);
    gr[b].insert(a);
  }
  int num = ceil(sqrt(n));
  dfs();
  if (cyc.size())
    while (par[cyc.back()] != cyc.front()) cyc.push_back(par[cyc.back()]);
  if (cyc.size() >= num) {
    cout << 2 << "\n" << cyc.size() << "\n";
    for (int ver : cyc) {
      cout << ver << " ";
    }
    return;
  }
  cout << 1 << "\n";
  for (int i = 0; i < num; i++) {
    int cur = INT32_MAX, ver = 0;
    for (int i = 1; i <= n; i++)
      if (!used[i] && gr[i].size() < cur) {
        cur = gr[i].size();
        ver = i;
      }
    used[ver] = 1;
    cout << ver << " ";
    for (int u : gr[ver]) {
      used[u] = 1;
      for (int w : gr[u])
        if (!used[w]) gr[w].erase(u);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Solve();
  return 0;
}
