import java.util.Scanner;

class VisitorNode {
    String name;
    VisitorNode next;

    VisitorNode(String name) {
        this.name = name;
        this.next = null;
    }
}

public class LibraryVisitors {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());

        VisitorNode head = null;
        VisitorNode tail = null;

        for (int i = 0; i < n; i++) {
            String name = sc.nextLine();

            // Check for invalid characters (anything not a letter or digit)
            if (!name.matches("[a-zA-Z0-9]+")) {
                System.out.println("Invalid input");
                return;
            }

            VisitorNode newNode = new VisitorNode(name);

            if (head == null) {
                head = newNode;
                tail = newNode; // first visitor is both head and tail
            } else {
                tail.next = newNode; // attach at the tail
                tail = newNode;      // update the tail
            }
        }

        // Print all visitors in order
        VisitorNode current = head;
        while (current != null) {
            System.out.print(current.name + " ");
            current = current.next;
        }
    }
}