Problem: A famous sculptor Cicasso goes to a world tour!

Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will entirely hold the world tour in his native country — Berland.

Cicasso is very devoted to his work and he wants to be distracted as little as possible. Therefore he will visit only four cities. These cities will be different, so no one could think that he has "favourites". Of course, to save money, he will chose the shortest paths between these cities. But as you have probably guessed, Cicasso is a weird person. Although he doesn't like to organize exhibitions, he likes to travel around the country and enjoy its scenery. So he wants the total distance which he will travel to be as large as possible. However, the sculptor is bad in planning, so he asks you for help. 

There are n cities and m one-way roads in Berland. You have to choose four different cities, which Cicasso will visit and also determine the order in which he will visit them. So that the total distance he will travel, if he visits cities in your order, starting from the first city in your list, and ending in the last, choosing each time the shortest route between a pair of cities — will be the largest. 

Note that intermediate routes may pass through the cities, which are assigned to the tour, as well as pass twice through the same city. For example, the tour can look like that: <image>. Four cities in the order of visiting marked as overlines: [1, 5, 2, 4].

Note that Berland is a high-tech country. So using nanotechnologies all roads were altered so that they have the same length. For the same reason moving using regular cars is not very popular in the country, and it can happen that there are such pairs of cities, one of which generally can not be reached by car from the other one. However, Cicasso is very conservative and cannot travel without the car. Choose cities so that the sculptor can make the tour using only the automobile. It is guaranteed that it is always possible to do. 

Input

In the first line there is a pair of integers n and m (4 ≤ n ≤ 3000, 3 ≤ m ≤ 5000) — a number of cities and one-way roads in Berland.

Each of the next m lines contains a pair of integers ui, vi (1 ≤ ui, vi ≤ n) — a one-way road from the city ui to the city vi. Note that ui and vi are not required to be distinct. Moreover, it can be several one-way roads between the same pair of cities. 

Output

Print four integers — numbers of cities which Cicasso will visit according to optimal choice of the route. Numbers of cities should be printed in the order that Cicasso will visit them. If there are multiple solutions, print any of them.

Example

Input

8 9
1 2
2 3
3 4
4 1
4 5
5 6
6 7
7 8
8 5


Output

2 1 8 7

Note

Let d(x, y) be the shortest distance between cities x and y. Then in the example d(2, 1) = 3, d(1, 8) = 7, d(8, 7) = 3. The total distance equals 13. 

Solution (in JAVA):

Solution:
/*-
 * Codeforces problem :
 * http://codeforces.com/problemset/problem/667/D
 *
 * Find the total longest path visiting exactly 4 cities
 * such that we use shortest path between each city.
 * 
 */

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;

/**
 * @author Karthik Venkataraman
 * @email kafy83@gmail.com
 */
public class WorldTour {

    static class InputReader {

        private static final int inputkb = 10240;
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), inputkb);
        }

        private String readNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException ex) {
                    throw new IllegalStateException(ex);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(readNext());
        }
    }

    static class WeightedEdge {

        private int from;
        private int to;
        private int weight;

        public WeightedEdge(int from, int to, int weight) {
            this.from = from;
            this.to = to;
            this.weight = weight;
        }
    }

    static class Graph {

        private int totalVertices;
        private int totalEdges;
        private List<WeightedEdge>[] adj;

        Graph(InputReader sc) {
            this.totalVertices = sc.nextInt();
            this.totalEdges = sc.nextInt();
            adj = (List<WeightedEdge>[]) new ArrayList[this.totalVertices + 1];
            for (int i = 1; i <= this.totalVertices; i++) {
                adj[i] = new ArrayList<>();
            }
            for (int e = 0; e < totalEdges; e++) {
                int from = sc.nextInt();
                int to = sc.nextInt();
                adj[from].add(new WeightedEdge(from, to, 1));
            }
        }
    }

    static class Bfs {

        private static final int MAX = Integer.MAX_VALUE;
        private int distTo[];
        private boolean marked[];

        Bfs(Graph G, int s, int[][] adj) {
            distTo = new int[G.totalVertices + 1];
            marked = new boolean[G.totalVertices + 1];
            for (int v = 0; v <= G.totalVertices; v++) {
                distTo[v] = MAX;
            }

            Queue<Integer> queue = new LinkedList<>();
            queue.add(s);
            marked[s] = true;
            distTo[s] = 0;
            while (!queue.isEmpty()) {
                int v = queue.remove();
                for (WeightedEdge e : G.adj[v]) {
                    int w = e.to;
                    if (!marked[w]) {
                        distTo[w] = distTo[v] + e.weight;
                        marked[w] = true;
                        queue.add(w);
                    }
                }
            }

            for (int v = 1; v <= G.totalVertices; v++) {
                adj[s][v] = distTo[v] == MAX ? -1 : distTo[v];
            }
        }
    }

    static class City implements Comparable<City> {

        private int cityId;
        private int distance;

        public City(int cityId, int distance) {
            this.cityId = cityId;
            this.distance = distance;
        }

        @Override
        public int compareTo(City that) {
            return that.distance - this.distance;
        }
    }

    private int[][] adj;

    private void compute() {
        InputReader sc = new InputReader(System.in);
        /*-InputReader sc = null;
        try {
            sc = new InputReader(new FileInputStream(new File("./resources/worldtour")));
        } catch (FileNotFoundException ex) {
            throw new IllegalArgumentException(ex);
        }*/

        //Build Graph
        Graph G = new Graph(sc);
        adj = new int[G.totalVertices + 1][G.totalVertices + 1];

        //Run BFS from each vertex and fill adjacency matrix
        for (int v = 1; v <= G.totalVertices; v++) {
            Bfs bfs = new Bfs(G, v, adj);
        }

        //printAdjMatrix();
        // Find the farthest 3 cities to each city
        City[][] threeFurthestTo = new City[G.totalVertices + 1][4];
        // Find the farthest 3 cities from each city
        City[][] threeFurthestFrom = new City[G.totalVertices + 1][4];

        for (int i = 1; i <= G.totalVertices; i++) {
            City[] source = new City[G.totalVertices + 1];
            int sourceIdx = 1;
            City[] dest = new City[G.totalVertices + 1];
            int destIdx = 1;
            for (int j = 1; j <= G.totalVertices; j++) {
                if (adj[j][i] > 0) {
                    source[sourceIdx] = new City(j, adj[j][i]);
                    sourceIdx++;
                }
                if (adj[i][j] > 0) {
                    dest[destIdx] = new City(j, adj[i][j]);
                    destIdx++;
                }
            }
            Arrays.sort(source, 1, sourceIdx);
            threeFurthestTo[i][1] = source[1];
            threeFurthestTo[i][2] = source[2];
            threeFurthestTo[i][3] = source[3];
            Arrays.sort(dest, 1, destIdx);
            threeFurthestFrom[i][1] = dest[1];
            threeFurthestFrom[i][2] = dest[2];
            threeFurthestFrom[i][3] = dest[3];
        }

        //printMax3To(threeFurthestTo);
        //printMax3From(threeFurthestFrom);
        //For every path a -> x -> y -> b find the largest path
        int max = 0;
        int[] result = new int[4];
        for (int x = 1; x <= G.totalVertices; x++) {
            for (int y = 1; y <= G.totalVertices; y++) {
                if (adj[x][y] > 0) {
                    for (int a = 1; a < 4; a++) {
                        City start = threeFurthestTo[x][a];
                        if (start != null) {
                            for (int b = 1; b < 4; b++) {
                                City end = threeFurthestFrom[y][b];
                                if (end != null) {
                                    int startCityId = start.cityId;
                                    int endCityId = end.cityId;
                                    if (isDistinctCity(startCityId, x, y, endCityId)) {
                                        int sum = adj[startCityId][x] + adj[x][y] + adj[y][endCityId];
                                        if (sum > max) {
                                            result[0] = startCityId;
                                            result[1] = x;
                                            result[2] = y;
                                            result[3] = endCityId;
                                            max = sum;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        for (int x : result) {
            System.out.print(x + " ");
        }
    }

    private boolean isDistinctCity(int a, int x, int y, int b) {
        if(a==x || a==y || a==b || x==y || x==b || y==b) {
            return false;
        }
        return true;
    }

    private void printAdjMatrix() {
        for (int i = 1; i < adj[1].length; i++) {
            for (int j = 1; j < adj.length; j++) {
                System.out.print(adj[i][j] + " ");
            }
            System.out.println();
        }
    }

    private void printMax3To(City[][] threeFurthestTo) {
        for (int i = 1; i < threeFurthestTo.length; i++) {
            System.out.println("-----------Farthest city to reach" + i + "-------------------------");
            for (int j = 1; j < threeFurthestTo[i].length; j++) {
                System.out.print(threeFurthestTo[i][j].cityId + " ");
            }
            System.out.println();
            System.out.println("------------------------------------");
        }
    }

    private void printMax3From(City[][] threeFurthestFrom) {
        for (int i = 1; i < threeFurthestFrom.length; i++) {
            System.out.println("-----------City Farthest from" + i + "-------------------------");
            for (int j = 1; j < threeFurthestFrom[i].length; j++) {
                System.out.print(threeFurthestFrom[i][j].cityId + " ");
            }
            System.out.println();
            System.out.println("------------------------------------");
        }
    }

    public static void main(String[] args) {
        WorldTour wt = new WorldTour();
        wt.compute();
    }
}