#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int mo = 1000000007;   inline void gn(long long &x) {     int sg = 1;     char c;     while (((c = getchar()) <  0  || c >  9 ) && c !=  - )       ;     c ==  -  ? (sg = -1, x = 0) : (x = c -  0 );     while ((c = getchar()) >=  0  && c <=  9 ) x = x * 10 + c -  0 ;     x *= sg;   }   inline void gn(int &x) {     long long t;     gn(t);     x = t;   }   inline void gn(unsigned long long &x) {     long long t;     gn(t);     x = t;   }   inline void gn(double &x) {     double t;     scanf( %lf , &t);     x = t;   }   inline void gn(long double &x) {     double t;     scanf( %lf , &t);     x = t;   }   template <class T1, class T2>   inline void gn(T1 &r, T2 &s) {     gn(r), gn(s);   }   template <class T1, class T2, class T3>   inline void gn(T1 &r, T2 &s, T3 &t) {     gn(r), gn(s), gn(t);   }   template <class T1, class T2, class T3, class T4>   inline void gn(T1 &r, T2 &s, T3 &t, T4 &u) {     gn(r), gn(s), gn(t), gn(u);   }   inline void gs(char *s) { scanf( %s , s); }   inline void gc(char &c) {     while ((c = getchar()) > 126 || c < 33)       ;   }   inline void pc(char c) { putchar(c); }   const int DX[] = {1, 0, -1, 0}, DY[] = {0, 1, 0, -1};   long long powmod(long long a, long long b) {     long long res = 1;     a %= mo;     for (; b; b >>= 1) {       if (b & 1) res = res * a % mo;       a = a * a % mo;     }     return res;   }   long long powmod(long long a, long long b, long long mo) {     long long res = 1;     a %= mo;     for (; b; b >>= 1) {       if (b & 1) res = res * a % mo;       a = a * a % mo;     }     return res;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   const int N = 5055, M = 111111;   int l, m, n, t, C, x, y, prex;   vector<int> a[N];   int dis[N][N];   void bfs(int k) {     for (int i = (1); i <= (n); ++i) dis[k][i] = inf;     dis[k][k] = 0;     queue<int> Q;     Q.push(k);     while (!Q.empty()) {       int p = Q.front();       Q.pop();       for (auto i : a[p]) {         if (dis[k][i] == inf) {           dis[k][i] = dis[k][p] + 1;           Q.push(i);         }       }     }   }   int p[9];   void update() {     printf( %d %d %d n , p[0], p[1], p[2]);     fflush(stdout);     if (p[0] == x || p[1] == x || p[2] == x) exit(0);     prex = x;     scanf( %d , &x);     if (p[0] == x || p[1] == x || p[2] == x) exit(0);   }   void go(int &x, int y) {     for (auto i : a[x])       if (dis[i][y] == dis[x][y] - 1) {         x = i;         break;       }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = (1); i <= (m); ++i)       scanf( %d%d , &x, &y), a[x].push_back(y), a[y].push_back(x);     for (int i = (1); i <= (n); ++i) bfs(i);     p[0] = p[1] = p[2] = 1;     x = -1;     while (1) {       update();       int q[9];       int ans = inf;       for (int i = (0); i <= (((int)(a[x]).size()) - 1); ++i)         for (int j = (0); j <= (((int)(a[x]).size()) - 1); ++j)           for (int k = (0); k <= (((int)(a[x]).size()) - 1); ++k) {             int res =                 dis[p[0]][a[x][i]] + dis[p[1]][a[x][j]] + dis[p[2]][a[x][k]];             if (i != j) res -= n;             if (j != k) res -= n;             if (i != k) res -= n;             if (res < ans)               ans = res, q[0] = a[x][i], q[1] = a[x][j], q[2] = a[x][k];           }       for (int i = (0); i <= (2); ++i)         if (dis[p[i]][x] == 1) q[i] = x;       for (int i = (0); i <= (2); ++i) go(p[i], q[i]);     }     return 0;   }