#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> g[N], a[N];
int k;
int d[N], p[N];
void dfs(int v) {
  for (int to : g[v]) {
    if (d[to] == -1) {
      d[to] = d[v] + 1;
      p[to] = v;
      dfs(to);
    } else if (d[to] < d[v] - 1 and d[v] - d[to] >= k - 1) {
      cout << 2 << '\n' << d[v] - d[to] + 1 << '\n';
      while (true) {
        cout << v + 1 << ' ';
        if (v == to) {
          break;
        }
        v = p[v];
      }
      exit(0);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  while (k * k < n) {
    ++k;
  }
  memset(d, -1, sizeof(d));
  d[0] = 0;
  dfs(0);
  for (int i = 0; i < n; ++i) {
    int v = d[i] % (k - 1);
    a[v].push_back(i);
    if (a[v].size() == k) {
      cout << 1 << '\n';
      for (int x : a[v]) {
        cout << x + 1 << ' ';
      }
      return 0;
    }
  }
  return 0;
}
