/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Collections;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		ArrayList<String> list = new ArrayList<>();
        list.add("19.15.15.90:61234");
        list.add("19.15.15.29:28010");
        list.add("19.15.15.80:8998");
        list.add("19.15.15.102:8998");
        list.add("25.25.24.15:8998");
        list.add("25.25.24.80:8998");
        list.add("210.192.38.25:8998");
        list.add("210.192.38.29:8998");

        // You should sort the list
        Collections.sort(list);

        // may aswell print the first one
        System.out.println(list.get(0));
        for (int i = 1; i < list.size(); i++) {
            int pos = nthIndexOf(list.get(i), '.', 3);
            if (!list.get(i).substring(0, pos).equals(list.get(i - 1).substring(0, pos))) {
                System.out.println(list.get(i));
            }
        }
    }

    public static int nthIndexOf(String text, char needle, int n) {
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) == needle) {
                n--;
                if (n == 0) {
                    return i;
                }
            }
        }
        return -1;
	}
}