Problem: Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. 

After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lexicographical order in normal sense. But it was always true that after some modification of the order of letters in alphabet, the order of authors becomes lexicographical!

She wants to know, if there exists an order of letters in Latin alphabet such that the names on the paper she is submitting are following in the lexicographical order. If so, you should find out any such order.

Lexicographical order is defined in following way. When we compare s and t, first we find the leftmost position with differing characters: si ≠ ti. If there is no such position (i. e. s is a prefix of t or vice versa) the shortest string is less. Otherwise, we compare characters si and ti according to their order in alphabet.

Input

The first line contains an integer n (1 ≤ n ≤ 100): number of names.

Each of the following n lines contain one string namei (1 ≤ |namei| ≤ 100), the i-th name. Each name contains only lowercase Latin letters. All names are different.

Output

If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'–'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on).

Otherwise output a single word "Impossible" (without quotes).

Examples

Input

3
rivest
shamir
adleman


Output

bcdefghijklmnopqrsatuvwxyz


Input

10
tourist
petr
wjmzbmr
yeputons
vepifanov
scottwu
oooooooooooooooo
subscriber
rowdark
tankengineer


Output

Impossible


Input

10
petr
egor
endagorion
feferivan
ilovetanyaromanova
kostka
dmitriyh
maratsnowbear
bredorjaguarturnik
cgyforever


Output

aghjlnopefikdmbcqrstuvwxyz


Input

7
car
care
careful
carefully
becarefuldontforgetsomething
otherwiseyouwillbehacked
goodluck


Output

acbdefhijklmnogpqrstuvwxyz

Solution (in JAVA):

Solution:

import java.util.*;
import java.io.*;
//TopologicalSortAdjacencyList
public class Solution {

  // Helper Edge class to describe edges in the graph
  static class Edge {
    int from, to, weight;

    public Edge(int f, int t, int w) {
      from = f;
      to = t;
      weight = w;
    }
  }

  

   private static boolean dfsFindCycle(
      int at, boolean[] visited,Stack<Integer> ordering, Map<Integer, List<Edge>> graph,boolean [] callingStack) {
    
    callingStack[at]=true;
    visited[at] = true;

    List<Edge> edges = graph.get(at);

    if (edges != null)
      for (Edge edge : edges){
      	if(callingStack[edge.to]) return false;
      	if (!visited[edge.to]) 
      		if(!dfsFindCycle(edge.to, visited, ordering, graph, callingStack)) return false;	
      }
    
    callingStack[at]=false;   
    ordering.add(at);
    return true;
  }

  public static Stack<Integer> topologicalSortWithCycles(Map<Integer, List<Edge>> graph, int numNodes) {

    Stack<Integer> ordering = new Stack<Integer>();
    boolean[] visited = new boolean[numNodes];
    boolean foundCycle=false;
    for (int at = 0; at < numNodes; at++)
      if (!visited[at]){
      	boolean [] callingStack=new boolean [numNodes];
      	if(!dfsFindCycle(at, visited, ordering, graph, callingStack)){
      		foundCycle = true;
      	}
      } 
    if(foundCycle) return null;
    return ordering;
  }


// Helper method that performs a depth first search on the graph to give
  // us the topological ordering we want. Instead of maintaining a stack
  // of the nodes we see we simply place them inside the ordering array
  // in reverse order for simplicity.
  private static int dfs(
      int i, int at, boolean[] visited, int[] ordering, Map<Integer, List<Edge>> graph) {

    visited[at] = true;

    List<Edge> edges = graph.get(at);

    if (edges != null)
      for (Edge edge : edges) if (!visited[edge.to]) i = dfs(i, edge.to, visited, ordering, graph);

    ordering[i] = at;
    return i - 1;
  }

  // Finds a topological ordering of the nodes in a Directed Acyclic Graph (DAG)
  // The input to this function is an adjacency list for a graph and the number
  // of nodes in the graph.
  //
  // NOTE: 'numNodes' is not necessarily the number of nodes currently present
  // in the adjacency list since you can have singleton nodes with no edges which
  // wouldn't be present in the adjacency list but are still part of the graph!
  //
  public static int[] topologicalSort(Map<Integer, List<Edge>> graph, int numNodes) {

    int[] ordering = new int[numNodes];
    boolean[] visited = new boolean[numNodes];

    int i = numNodes - 1;
    for (int at = 0; at < numNodes; at++)
      if (!visited[at]) i = dfs(i, at, visited, ordering, graph);

    return ordering;
  }

  // A useful application of the topological sort is to find the shortest path
  // between two nodes in a Directed Acyclic Graph (DAG). Given an adjacency list
  // this method finds the shortest path to all nodes starting at 'start'
  //
  // NOTE: 'numNodes' is not necessarily the number of nodes currently present
  // in the adjacency list since you can have singleton nodes with no edges which
  // wouldn't be present in the adjacency list but are still part of the graph!
  //
  public static Integer[] dagShortestPath(Map<Integer, List<Edge>> graph, int start, int numNodes) {

    int[] topsort = topologicalSort(graph, numNodes);
    Integer[] dist = new Integer[numNodes];
    dist[start] = 0;

    for (int i = 0; i < numNodes; i++) {

      int nodeIndex = topsort[i];
      if (dist[nodeIndex] != null) {
        List<Edge> adjacentEdges = graph.get(nodeIndex);
        if (adjacentEdges != null) {
          for (Edge edge : adjacentEdges) {

            int newDist = dist[nodeIndex] + edge.weight;
            if (dist[edge.to] == null) dist[edge.to] = newDist;
            else dist[edge.to] = Math.min(dist[edge.to], newDist);
          }
        }
      }
    }

    return dist;
  }

  public static boolean compareStrings(Map<Integer, List<Edge>> graph,String a,String b){
  	int i;
  	for(i=0;i<Math.min(a.length(),b.length());i++){
  		if(a.charAt(i)!=b.charAt(i)) break;
  	}
  	// if a is prefix no dependency needed
  	if(i == a.length()) return true;
  	if(i == b.length()) return false;
  	graph.get(a.charAt(i)-'a').add(new Edge(a.charAt(i)-'a', b.charAt(i)-'a' , 1));
  	return true;
  }

  // Example usage of topological sort
  public static void main(String[] args) {
	Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    int n = in.nextInt();  // Scanner has functions to read ints, longs, strings, chars, etc.
    in.nextLine();
    Map<Integer, List<Edge>> graph = new HashMap<>();
    for (int i = 0; i < 26; i++) graph.put(i, new ArrayList<>());
    String [] words=new String[n];
    for (int i = 0; i < n; ++i) {
      words[i]=in.nextLine();
      //System.out.println(words[i]);
    }
    for(int i=1;i<n;i++){
    	if(!compareStrings(graph,words[i-1],words[i])){
    		System.out.println("Impossible");
    		return;
    	}
    }/*
    for(int i=0;i<25;i++){
    	for(Edge e:graph.get(i))
    		System.out.println(e.from+" "+e.to);	
    }*/
    
    Stack<Integer> ordering = topologicalSortWithCycles(graph, 26);
    if(ordering == null){
    	System.out.println("Impossible");
    	return;
    }
    for(int i=0;i<26;i++){
    	System.out.print((char)(ordering.pop()+'a'));
    }
    // Graph setup
    /*final int N = 7;
    Map<Integer, List<Edge>> graph, = new HashMap<>();
    for (int i = 0; i < N; i++) graph.put(i, new ArrayList<>());
    graph.get(0).add(new Edge(0, 1, 3));
    graph.get(0).add(new Edge(0, 2, 2));
    graph.get(0).add(new Edge(0, 5, 3));
    graph.get(1).add(new Edge(1, 3, 1));
    graph.get(1).add(new Edge(1, 2, 6));
    graph.get(2).add(new Edge(2, 3, 1));
    graph.get(2).add(new Edge(2, 4, 10));
    graph.get(3).add(new Edge(3, 4, 5));
    graph.get(5).add(new Edge(5, 4, 7));

    int[] ordering = topologicalSort(graph, N);

    // // Prints: [6, 0, 5, 1, 2, 3, 4]
    System.out.println(java.util.Arrays.toString(ordering));

    // Finds all the shortest paths starting at node 0
    Integer[] dists = dagShortestPath(graph, 0, N);

    // Find the shortest path from 0 to 4 which is 8.0
    System.out.println(dists[4]);

    // Find the shortest path from 0 to 6 which
    // is null since 6 is not reachable!
    System.out.println(dists[6]);*/
  }
}