import java.io.*;
import java.util.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone {
  static int compare(String a, String b) {
    int ai = 0, bi = 0;
    while (ai < a.length() && bi < b.length()) {
      int an = 0;
      while (ai < a.length() && a.charAt(ai) != '.') {
        an = 10 * an + Character.getNumericValue(a.charAt(ai));
        ++ai;
      }
      ++ai; // Skip the dot.

      int bn = 0;
      while (bi < b.length() && b.charAt(bi) != '.') {
        bn = 10 * bn + Character.getNumericValue(b.charAt(bi));
        ++bi;
      }
      ++bi; // Skip the dot.

      int cmp = Integer.compare(an, bn);
      if (cmp != 0) return cmp;
    }
    if (ai < a.length()) return 1;
    if (bi < b.length()) return -1;
    return 0;
  }

  public static void main(String[] args) throws java.lang.Exception {
    List<String> lines = new ArrayList<>();
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
      String line;
      while ((line = reader.readLine()) != null) {
        lines.add(line);
      }
    }
    Collections.shuffle(lines);
    System.out.println("Shuffled: " + lines);

    lines.sort(Ideone::compare);
    System.out.println("Sorted: " + lines);
  }
}
