#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const int N = 2e5 + 100;
int n, m, k, mmin = inf, pos = -1, deep[N], pre[N];
vector<int> node[N];
vector<int> p[2];
void DFS(int u, int fa, int dep) {
  p[dep % 2].push_back(u);
  for (auto v : node[u]) {
    if (v == fa) continue;
    DFS(v, u, (dep + 1) % 2);
  }
}
void dfs(int u, int fa, int dep) {
  deep[u] = dep;
  pre[u] = fa;
  for (auto v : node[u]) {
    if (v == fa) continue;
    if (deep[v] != 0) {
      if (deep[u] - deep[v] + 1 >= 0 && mmin > deep[u] - deep[v] + 1) {
        mmin = deep[u] - deep[v] + 1;
        pos = u;
      }
    } else
      dfs(v, u, dep + 1);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    node[u].push_back(v);
    node[v].push_back(u);
  }
  if (m == n - 1) {
    DFS(1, -1, 0);
    if (p[0].size() < p[1].size()) swap(p[0], p[1]);
    puts("1");
    for (int i = 0; i < (k + 1) / 2; i++) printf("%d ", p[0][i]);
  } else {
    dfs(1, -1, 1);
    if (mmin <= k) {
      puts("2");
      printf("%d\n", mmin);
      while (mmin--) {
        printf("%d ", pos);
        pos = pre[pos];
      }
    } else {
      puts("1");
      int num = (k + 1) / 2;
      while (num--) {
        printf("%d ", pos);
        pos = pre[pos];
        pos = pre[pos];
      }
    }
  }
  return 0;
}
