N, M = gets.split.map(&:to_i)
lines = []
M.times do
  lines << gets.split.map(&:to_i)
end

if lines.size % 2 != 0
  puts '-1'
end

lines.each do |line|
  line.rotate! if lines.select{|line2| line2[1] == line[0]}.size % 2 == 1
end

puts lines.map{|line| line.join(' ')}.join("\n")
