$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

$memo = {}

def memo_key(nodes,sets)
  nodes.join('-') + ',' + sets.join('-')
end

def search(nodes, sets)
  mem_key = memo_key(nodes,sets)
  if $memo[mem_key]
    return $memo[mem_key]
  end

  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])
      $memo[mem_key] = [nodes]
      return [ nodes ]
    else
      $memo[mem_key] = nil
      return nil
    end
  elsif nodes.size > 2
    node_to_sets = construct_node_to_sets(nodes,sets)
    node_to_sets.each do |node,ss|
      ss.each do |s|
        next if node == s
        raise unless sets.include?(s)
        s2 = sets - [s]
        found = search( nodes-[node], s2 )
        if found
          other = ES[s].find {|x| x != node and nodes.include?(x)}
          found.push([node,other])
          $memo[mem_key] = found
          return found
        end
      end
      $memo[mem_key] = nil
      return nil
    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

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