$debug = false
def d(*s)
  pp *s if $debug == true
end

N = readline.to_i

ES = (N-1).times.map do |i|
  readline.split(' ')[1..-1].map(&:to_i)
end

d ES


def search(nodes, sets)
  d "nodes: #{nodes}, sets: #{sets}"
  raise unless nodes.size-1 == sets.size
  if nodes.size == 2
    s = ES[sets[0]]
    if s.include?(nodes[0]) and s.include?(nodes[1])
      return [ nodes ]
    else
      return nil
    end
  elsif nodes.size > 2
    node_to_sets = construct_node_to_sets(nodes,sets)
    d "node_to_sets: #{node_to_sets.inspect}"
    node_to_sets.each do |node,ss|
      d "node: #{node}"
      ss.each do |s|
        next if node == s
        raise unless sets.include?(s)
        s2 = sets - [s]
        d "s: #{s}, s2: #{s2}"
        found = search( nodes-[node], s2 )
        d "found : #{found.inspect}"
        if found
          other = ES[s].find {|x| x != node and nodes.include?(x)}
          found.push([node,other])
          return found
        else
          return nil
        end
      end
    end
  else
    raise "must not happen"
  end
end

def construct_node_to_sets(nodes, sets)
  h = Hash.new { [] }
  sets.each do |i|
    ES[i].each do |n|
      h[n] += [i] if nodes.include?(n)
    end
  end
  h.sort_by {|k,v| v.size}
end

#pp node_eis
nodes = (1..N).to_a
sets = (0...ES.size).to_a

d nodes, sets
tree = search(nodes, sets)
if tree
  puts tree.map {|x| x.join(' ')}
else
  puts -1
end
