import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; immutable int INF = 1 << 29; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto M = s[1]; auto K = s[2]; auto G = new int[][](N); auto D = new int[][](N, N); foreach (_; 0..M) { s = readln.split.map!(to!int); G[s[0]-1] ~= s[1]-1; G[s[1]-1] ~= s[0]-1; } foreach (i; 0..N) foreach (j; 0..N) D[i][j] = i == j ? 0 : INF; foreach (i; 0..N) foreach (j; G[i]) D[i][j] = 1; foreach (i; 0..N) foreach (j; 0..N) foreach (k; 0..N) D[j][k] = min(D[j][k], D[j][i] + D[i][k]); bool can_travel(const int[] nodes) { int n = nodes.length.to!int; auto dp = new int[][](1<