#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, sq, dep[N];
vector<int> adj[N], now;
bool vis[N];
void dfs(int node) {
  now.push_back(node);
  dep[node] = now.size();
  for (auto& u : adj[node]) {
    if (!dep[u])
      dfs(u);
    else if (dep[node] - dep[u] + 1 >= sq) {
      cout << 2 << '\n';
      cout << dep[node] - dep[u] + 1 << '\n';
      for (int i = dep[u] - 1; i < dep[node]; i++) cout << now[i] << ' ';
      exit(0);
    }
  }
  if (!vis[node]) {
    for (auto& u : adj[node]) vis[u] = true;
  }
  now.pop_back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  while (sq * sq < n) sq++;
  while (m--) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  cout << 1 << '\n';
  for (int i = 1; sq; i++) {
    if (!vis[i]) {
      cout << i << ' ';
      sq--;
    }
  }
}
