#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long hell = round(1e12);
vector<long long> dis;
vector<long long> par;
vector<long long> marked;
long long sq;
long long dfs(vector<vector<long long>>& v, vector<long long>& vis,
              long long cur, long long d) {
  long long m = 0;
  vis[cur] = 1;
  dis[cur] = d;
  for (auto an : v[cur]) {
    if (vis[an] == 1) {
      if (dis[an] <= dis[cur] - sq + 1) {
        cout << 2 << endl;
        cout << dis[cur] - dis[an] + 1 << endl;
        while (cur != an) {
          cout << cur << " ";
          cur = par[cur];
        }
        cout << an;
        return 1;
      }
    }
  }
  long long p = 0;
  for (auto ch : v[cur]) {
    if (vis[ch] == 0) {
      par[ch] = cur;
      p = dfs(v, vis, ch, d + 1);
      if (p == 1) return 1;
    }
  }
  if (marked[cur] == 0)
    for (auto ch : v[cur]) marked[ch] = 1;
  vis[cur] = 2;
  return 0;
}
signed solve() {
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  vector<vector<long long>> v(n + 1, vector<long long>(0));
  vector<long long> vis(n + 1);
  sq = sqrtl(n);
  if (sq * sq != n) sq++;
  dis.resize(n + 1);
  par.resize(n + 1);
  marked.resize(n + 1);
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  long long p = dfs(v, vis, 1, 0);
  long long cnt = 0;
  if (p == 0) {
    cout << 1 << endl;
    for (long long i = 1; i <= n; i++) {
      if (marked[i] == 0) {
        cout << i << " ";
        cnt++;
        if (cnt == sq) return 0;
      }
    }
  }
  return 0;
}
signed main() {
  long long t = 1;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  while (t--) {
    solve();
  }
  return 0;
}
