#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> g[200010];
int vis[200010], d[200010];
stack<int> his;
void dfs(int u, int dd) {
  his.push(u);
  d[u] = dd;
  for (int v : g[u]) {
    if (!d[v])
      dfs(v, dd + 1);
    else if (d[u] - d[v] + 1 >= ceil(sqrt(n))) {
      puts("2");
      printf("%d\n", d[u] - d[v] + 1);
      for (int i = d[v] - 1; i < d[u]; ++i) {
        printf("%d ", his.top());
        his.pop();
      }
      exit(0);
    }
  }
  if (!vis[u])
    for (int v : g[u]) vis[v] = 1;
  his.pop();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, u, v; i < m; ++i) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 1);
  puts("1");
  int visT = 0;
  for (int i = 1; visT < ceil(sqrt(n)); ++i) {
    if (!vis[i]) printf("%d ", i), ++visT;
  }
  puts("");
  return 0;
}
