#include <bits/stdc++.h>
using namespace std;
const int N = 200500;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;
vi g[N];
int path[N];
int color[N];
int n, m, need;
int dist[N];
vpii o;
void print_answer(int x, int y) {
  cout << 2 << "\n";
  cout << y - x + 1 << "\n";
  for (int i = x; i <= y; ++i) cout << path[i] << " ";
  cout << "\n";
  exit(0);
}
void dfs(int v, int from) {
  color[v] = 1;
  dist[v] = dist[from] + 1;
  path[dist[v]] = v;
  for (int w : g[v]) {
    if (color[w]) {
      if (dist[v] - dist[w] + 1 >= need) print_answer(dist[w], dist[v]);
    } else {
      dfs(w, v);
    }
  }
  color[v] = 2;
  o.push_back({dist[v], v});
}
int main() {
  cin >> n >> m;
  need = int(sqrt(n));
  if (need * need < n) need++;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, 0);
  sort(o.begin(), o.end());
  reverse(o.begin(), o.end());
  m = 0;
  for (auto p : o) {
    int v = p.second;
    if (color[v] == 3) continue;
    color[v] = 3;
    path[m++] = v;
    if (m == need) {
      cout << "1\n";
      for (int i = 0; i < m; ++i) cout << path[i] << " ";
      cout << "\n";
      return 0;
    }
    for (int i : g[v]) color[i] = 3;
  }
  return 0;
}
