//Written by Tanya Khovanova and Sergei Bernstein

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * ReversibleWordsFinder takes lines of text on standard input and prints 
 * each line whose reverse exists in the input to standard output.
 */

public class ReversibleWordsFinder {
  public static void main(String[] args) throws IOException {
    List<String> dictionary = new LinkedList<String>();
    Set<String> dictionarySet = new HashSet<String>();
    BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));
    for(String dictWord = reader.readLine(); dictWord != null; dictWord = reader.readLine()) {
      dictionary.add(dictWord);
      dictionarySet.add(dictWord);
    }
    for (Iterator<String> i = dictionary.iterator(); i.hasNext();) {
      String word = i.next();
      StringBuffer wordBuffer = new StringBuffer(word);
      String wordBackwards = wordBuffer.reverse().toString();
      if (dictionarySet.contains(wordBackwards))
	System.out.println(word);
    }
  }
}
