#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MAX_N = 300005;
vector<int> adj[MAX_N];
long long lvl[MAX_N];
vector<long long> s;
bool noInd[MAX_N], cycle = false;
long long sq;
void visit(long long vertex) {
  if (cycle) return;
  s.push_back(vertex);
  lvl[vertex] = s.size();
  for (int nxt : adj[vertex]) {
    if (lvl[nxt] == 0) {
      visit(nxt);
    } else if (lvl[vertex] - lvl[nxt] >= sq - 1) {
      cout << 2 << endl << lvl[vertex] - lvl[nxt] + 1 << endl;
      for (int i = (lvl[nxt] - 1); i < (int)(lvl[vertex]); i++)
        cout << s[i] << " ";
      exit(0);
    }
  }
  if (!noInd[vertex])
    for (auto nxt : adj[vertex]) noInd[nxt] = true;
  s.pop_back();
}
long long ceil_sq(long long x) {
  long long ans = 1;
  while (ans * ans < x) ans++;
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (int)(m); i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b), adj[b].push_back(a);
  }
  sq = ceil_sq(n);
  lvl[1] = 1;
  visit(1);
  cout << "1\n";
  for (int i = 1; sq; i++) {
    if (!noInd[i]) cout << i << " ", sq--;
  }
  cout << endl;
  return 0;
}
