n = gets.to_i
b1f1 = [0,0,0,0,0,0,0,0,0,0]
b1f2 = [0,0,0,0,0,0,0,0,0,0]
b1f3 = [0,0,0,0,0,0,0,0,0,0]
b2f1 = [0,0,0,0,0,0,0,0,0,0]
b2f2 = [0,0,0,0,0,0,0,0,0,0]
b2f3 = [0,0,0,0,0,0,0,0,0,0]
b3f1 = [0,0,0,0,0,0,0,0,0,0]
b3f2 = [0,0,0,0,0,0,0,0,0,0]
b3f3 = [0,0,0,0,0,0,0,0,0,0]
b4f1 = [0,0,0,0,0,0,0,0,0,0]
b4f2 = [0,0,0,0,0,0,0,0,0,0]
b4f3 = [0,0,0,0,0,0,0,0,0,0]
n.times do
 x = gets()
 y = x.split()
 b = y[0].to_i
 f = y[1].to_i
 r = y[2].to_i
 v = y[3].to_i
 if b == 1
  if f == 1
   b1f1[r-1] += v 
  elsif f == 2
   b1f2[r-1] += v
  else
   b1f3[r-1] += v
  end
 elsif b == 2
  if f == 1
   b2f1[r-1] += v 
  elsif f == 2
   b2f2[r-1] += v
  else
   b2f3[r-1] += v
  end
 elsif b == 3
  if f == 1
   b3f1[r-1] += v 
  elsif f == 2
   b3f2[r-1] += v
  else
   b3f3[r-1] += v
  end
 else
  if f == 1
   b4f1[r-1] += v 
  elsif f == 2
   b4f2[r-1] += v
  else
   b4f3[r-1] += v
  end
 end
end
i = 0
b1f1.each do |b1|
 if i != (b1f1.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b1f2.each do |b2|
 if i != (b1f2.length - 1)
  print " #{b2}"
 else
  puts " #{b2}"
 end
 i += 1
end

i = 0
b1f3.each do |b1|
 if i != (b1f3.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end
puts "#"*20
i = 0
b2f1.each do |b1|
 if i != (b2f1.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b2f2.each do |b1|
 if i != (b2f2.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b2f3.each do |b1|
 if i != (b2f3.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end
puts "#"*20
i = 0
b3f1.each do |b1|
 if i != (b3f1.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b3f2.each do |b1|
 if i != (b3f2.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b3f3.each do |b1|
 if i != (b3f3.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end
puts "#"*20
i = 0
b4f1.each do |b1|
 if i != (b4f1.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end
i = 0
b4f2.each do |b1|
 if i != (b4f2.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end

i = 0
b4f3.each do |b1|
 if i != (b4f3.length - 1)
  print " #{b1}"
 else
  puts " #{b1}"
 end
 i += 1
end
