def graph()
  n = gets.to_i
  a = []
  b = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
  for i in 0..n-1
    a[i] = gets.split(' ').map(&:to_i)
    if a[i][1] > 0
      for j in 2..a[i][1]+1
        c = a[i][j] - 1
        b[i][c] = 1
      end
    end
    puts b[i].join(' ')    
  end
end

graph()