/**
 * Wrong solution, must get <= 30 points.
 */

import java.io.*;
import java.util.*;

public class maze_mb_greedy_1 {
    private static class Edge implements Comparable<Edge> {
        public final int source, target;
        public final String label;

        public Edge(int source, int target, String label) {
            this.source = source;
            this.target = target;
            this.label = label;
        }

        public int compareTo(Edge e) {
            return label.compareTo(e.label);
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("maze.in"));
        final int n, m;
        {
            String line = in.readLine();
            int ws = line.indexOf(" ");
            n = Integer.parseInt(line.substring(0, ws));
            m = Integer.parseInt(line.substring(ws + 1));
        }
        @SuppressWarnings({"unchecked"}) List<Edge>[] edges = new List[n];
        for (int i = 0; i < n; ++i) {
            edges[i] = new ArrayList<Edge>();
        }
        for (int i = 0; i < m; ++i) {
            String line = in.readLine();
            int fws = line.indexOf(" ");
            int lws = line.lastIndexOf(" ");
            int src = Integer.parseInt(line.substring(0, fws)) - 1;
            int trg = Integer.parseInt(line.substring(fws + 1, lws)) - 1;
            String lbl = line.substring(lws + 1);
            edges[src].add(new Edge(src, trg, lbl));
        }
        final int source, target;
        {
            String line = in.readLine();
            int ws = line.indexOf(" ");
            source = Integer.parseInt(line.substring(0, ws)) - 1;
            target = Integer.parseInt(line.substring(ws + 1)) - 1;
        }
        in.close();

        StringBuilder ans = new StringBuilder();
        int current = source;

        boolean[] used = new boolean[n];
        while (current != target) {
            if (used[current]) {
                ans.setLength(0);
                ans.append("Impossible");
                break;
            }
            used[current] = true;
            List<Edge> next = edges[current];
            Collections.sort(next);
            for (int i = 0; i < next.size(); ++i) {
                Edge e = next.get(i);
                if (!used[e.target]) {
                    ans.append(e.label);
                    current = e.target;
                    break;
                }
            }
        }

        PrintWriter out = new PrintWriter("maze.out");
        out.println(ans);
        out.close();
    }
}