class NoListaA {

    String s;
    NoListaA next;

    NoListaA (String q) {
        this.s = q;
        this.next = null;
    }
}

class ListaA {

    NoListaA inicio;

    ListaA() {
        this.inicio = null;
    }

    String imprimir() {
        String retorno = this.inicio.s;
        while (this.inicio.next != null) {
            this.inicio = this.inicio.next;
            retorno = retorno + "\n" + this.inicio.s;
        }
        return retorno;
    }

}

public class QuestaoA {

    static void main (String[] Args) {
        Arquivo arq = new Arquivo("QuestaoA.in", "QuestaoA.out");
        ListaA lista = new ListaA();
        NoListaA no;
        String lida;
        while (!arq.isEndOfFile()) {
            lida = arq.readLine();
            no = new NoListaA(lida);
            no.next = lista.inicio;
            lista.inicio = no;
        }
        arq.println(lista.imprimir());
        arq.close();
    }
}