#include<stdio.h>#include<string.h>static int n, m, map[1000][1000], visit[1000], total[1000], max;static void dfs(int now, int depth){visit[now] = 1;if (depth > max)max = depth;int i;for (i = 0; i < total[now]; i++)if (!visit[map[now][i]])dfs(map[now][i], depth + 1);}int main(){int a, b;while (scanf("%d %d", &n, &m) != EOF){memset(map, 0, sizeof(map));memset(total, 0, sizeof(total));while (m--){scanf("%d %d", &a, &b);map[a][total[a]++] = b;map[b][total[b]++] = a;}int i;max = -1;for (i = 0; i < n; i++){memset(visit, 0, sizeof(visit));dfs(i, 1);}if (max > 7)printf("%dn", max);elseputs("Impossible");}return 0;}


