if ($head->next == null) {
                $head->next = $p;
            } else {
                $start = $head;
                while ($start->next != null) {
                    $start = $start->next;
                }
                $start->next = $p;
            }
        }
        return $head;
    }
    function display($head)
    {
        $start = $head;
        while ($start) {
            echo $start->data, ' ';
            $start = $start->next;
        }
    }
}
$T = intval(fgets(STDIN));
$head = null;
$mylist = new Solution();
while ($T-- > 0) {
    $data = intval(fgets(STDIN));
    $head = $mylist->insert($head, $data);
}
$head = $mylist->removeDuplicates($head);
$mylist->display($head);