>>795
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Stack;

class Test{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
Stack<String> stack = new Stack<String>();
while(!(line = br.readLine()).equals(".")){
stack.push(line);
}
while(!stack.isEmpty()){
System.out.println(stack.pop());
}
}
}