#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int N = 2e5 + 36;
const double long EPS = 1e-8;
const double long Pi = 3.14159265358979323846;
mt19937 gen(19937);
vector<int> g[N];
int d[N], us[N], O = 1, pr[N], tin[N], tout[N], tme = 0;
int color[N];
void dfs(int v, int D = 1, int P = -1) {
  tin[v] = ++tme;
  us[v] = O;
  d[v] = D;
  pr[v] = P;
  for (auto to : g[v]) {
    if (us[to] == O) continue;
    dfs(to, D + 1, v);
  }
  tout[v] = ++tme;
}
inline bool upper(int a, int b) {
  return tin[a] <= tin[b] && tout[a] >= tout[b];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > h;
  for (int i(0); i < m; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    h.push_back({x, y});
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int mn = sqrt(n);
  if (mn * mn < n) {
    ++mn;
  }
  int T = 40;
  while (T--) {
    vector<int> h(n);
    for (int i(0); i < n; ++i) {
      color[i] = 0;
      h[i] = i;
    }
    shuffle(h.begin(), h.end(), gen);
    vector<int> ans;
    for (int i(0); i < n; ++i) {
      if (color[h[i]] == 0) {
        bool f = 1;
        for (auto to : g[h[i]]) {
          if (color[to] == 2) {
            f = 0;
            break;
          }
        }
        if (f == 1) {
          for (auto to : g[h[i]]) {
            color[to] = 1;
          }
          color[h[i]] = 2;
          ans.push_back(h[i]);
        }
      }
    }
    if ((int)ans.size() >= mn) {
      cout << 1 << endl;
      for (int i(0); i < mn; ++i) {
        cout << ans[i] + 1 << ' ';
      }
      return 0;
    }
  }
  while (true) {
    ++O;
    tme = 0;
    int x = gen() % n;
    dfs(x);
    pair<int, int> ans = {-1, -1};
    for (auto to : h) {
      if (((to.first == x || to.second == x) ||
           (!upper(to.first, to.second) && !upper(to.second, to.first))) &&
          d[to.first] + d[to.second] - 1 >= mn) {
        ans = to;
        break;
      }
    }
    if (ans.first != -1) {
      cout << 2 << endl;
      cout << d[ans.first] + d[ans.second] - 1 << endl;
      vector<int> a, b;
      for (int i(ans.first); i > -1; i = pr[i]) {
        a.push_back(i);
      }
      for (int i(ans.second); i > -1; i = pr[i]) {
        b.push_back(i);
      }
      for (auto to : a) {
        cout << to + 1 << ' ';
      }
      for (int i(int(b.size()) - 2); i >= 0; --i) {
        cout << b[i] + 1 << ' ';
      }
      return 0;
    }
  }
  return 0;
}
