#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int N = 100010, M = 200010;
int h[N], e[M * 2], nex[M * 2], idx, n, m, k;
vector<int> ans;
void add(int x, int y) {
  e[idx] = y;
  nex[idx] = h[x];
  h[x] = idx++;
}
int dep[N], fa[N], p, min_round;
void dfs(int u, int pre) {
  fa[u] = pre;
  for (int i = h[u]; ~i; i = nex[i]) {
    if (e[i] == pre) continue;
    if (dep[e[i]] == -1) {
      dep[e[i]] = dep[u] + 1;
      dfs(e[i], u);
    } else if (abs(dep[u] - dep[e[i]]) + 1 <= k) {
      puts("2");
      cout << abs(dep[u] - dep[e[i]]) + 1 << endl;
      k = abs(dep[u] - dep[e[i]]) + 1;
      int pos = u;
      for (int j = 0; j < k; ++j) {
        cout << pos << " ";
        pos = fa[pos];
      }
      exit(0);
    } else if (min_round > abs(dep[u] - dep[e[i]]) + 1) {
      min_round = dep[u] - dep[e[i]] + 1;
      p = u;
    }
  }
}
bool dfs2(int u, int pre) {
  if (h[u] == -1) {
    ans.push_back(u);
    return true;
  } else {
    bool su = 0;
    for (int i = h[u]; ~i; i = nex[i]) {
      if (e[i] == pre) continue;
      if (dfs2(e[i], u)) su = 1;
    }
    if (!su) ans.push_back(u);
    return !su;
  }
}
int main(int argc, char* argv[]) {
  memset(h, -1, sizeof h);
  memset(dep, -1, sizeof dep);
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    add(x, y);
    add(y, x);
  }
  p = -1;
  min_round = n + 1;
  dep[1] = 0;
  dfs(1, 0);
  puts("1");
  if (m != n - 1) {
    k = (k + 1) / 2;
    for (int i = 0; i < n && k; ++i, p = fa[p]) {
      if (i % 2) continue;
      cout << p << " ";
      k--;
    }
  } else {
    ans.clear();
    dfs2(1, 0);
    for (int i = 0; i < (k + 1) / 2; ++i) {
      cout << ans[i] << " ";
    }
  }
  return 0;
}
