#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int MAXN = 1.1e5;
vector<int> adj[MAXN];
int depth[MAXN];
int parent[MAXN];
int blocked[MAXN];
bool finished = false;
int need;
vector<int> independent;
void rek(int n, int d, int p) {
  parent[n] = p;
  depth[n] = d;
  blocked[n] = 0;
  for (auto to : adj[n]) {
    if (to == p) continue;
    if (parent[to] == -1) rek(to, d + 1, n);
  }
  if (!finished) {
    if (blocked[n] == 0) {
      independent.push_back(n);
      for (auto to : adj[n]) blocked[to]++;
      if (int((independent).size()) == need) {
        cout << "1\n";
        for (int i = (0); i < (need); i++)
          cout << independent[i] << ((i == need - 1) ? "\n" : " ");
        finished = true;
      }
    }
  }
  if (!finished) {
    for (auto to : adj[n]) {
      if (to == p) continue;
      if (depth[n] - depth[to] + 1 >= need) {
        cout << "2\n" << depth[n] - depth[to] + 1 << "\n";
        for (int k = n; k != to; k = parent[k]) {
          cout << k << " ";
        }
        cout << to << endl;
        finished = true;
        break;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  for (int m = (0); m < (M); m++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  need = 1;
  while (need * need < N) ++need;
  for (int i = (0); i < (N + 1); i++) parent[i] = -1;
  independent.clear();
  rek(1, 0, -2);
  assert(finished);
  return 0;
}
