#include <bits/stdc++.h>
using namespace std;
int n, m, z;
vector<int> adj[300000];
stack<int> st;
int level[300000], sign[300000];
vector<int> pos, neg;
vector<int> signrec[2];
void dfs(int x, int p) {
  st.push(x);
  level[x] = level[p] + 1;
  for (auto it : adj[x]) {
    if (it == p) continue;
    if (level[it]) {
      if (level[x] - level[it] + 1 >= z) {
        cout << 2 << endl;
        cout << level[x] - level[it] + 1 << endl;
        while (st.top() != it) {
          cout << st.top() << " ";
          st.pop();
        }
        cout << it << " ";
        exit(0);
      }
      continue;
    }
    dfs(it, x);
  }
  st.pop();
  int temp = 0;
  for (auto it : adj[x]) {
    temp |= sign[it];
  }
  if (temp == 0) {
    sign[x] = 1;
    pos.push_back(x);
  } else {
    neg.push_back(x);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  z = ceil(sqrt(n));
  dfs(1, 0);
  cout << 1 << endl;
  for (int i = 0; i < z; i++) {
    cout << pos[i] << " ";
  }
}
