#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> g[100055];
int depth[100055];
vector<int> vs;
vector<int> odd, even;
void dfs(int v, int par = -1, int d = 0) {
  depth[v] = d;
  vs.push_back(v);
  if (d % 2 == 0) {
    odd.push_back(v);
  } else {
    even.push_back(v);
  }
  for (auto u : g[v])
    if (u != par) {
      if (depth[u] == -1) {
        dfs(u, v, d + 1);
      } else {
        if (depth[v] - depth[u] + 1 <= k) {
          puts("2");
          printf("%d\n", depth[v] - depth[u] + 1);
          int state = 0;
          for (auto w : vs) {
            if (w == u) state = 1;
            if (state == 1) {
              printf("%d ", w + 1);
            }
            if (w == v) state = 0;
          }
          puts("");
          exit(0);
        }
      }
    }
  for (auto u : g[v])
    if (u != par) {
      if (depth[u] < depth[v]) {
        puts("1");
        int state = 0;
        vector<int> fuck;
        int diu = 0;
        for (auto w : vs) {
          if (w == u) state = 1;
          if (state == 1) {
            if (diu == 0 && w != v) {
              fuck.push_back(w);
            }
            diu ^= 1;
          }
          if (w == v) state = 0;
        }
        for (int i = 0; i < (k + 1) / 2; i++) {
          printf("%d ", fuck[i] + 1);
        }
        puts("");
        exit(0);
      }
    }
  vs.pop_back();
}
int main() {
  cin >> n >> m >> k;
  while (m--) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memset(depth, -1, sizeof(depth));
  dfs(0);
  if (odd.size() < (k + 1) / 2) {
    swap(odd, even);
  }
  puts("1");
  for (int i = 0; i < (k + 1) / 2; i++) {
    printf("%d ", odd[i] + 1);
  }
  puts("");
  return 0;
}
