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

flgs = []
N.times do
  flgs << 0
end

lines.each do |line|
  flgs[line[0] - 1] += 1
  if line.map{|p| flgs[p - 1]}.inject{|sum, n| sum + n} % 2 == 1
    line.rotate!
    flgs[line[1] - 1] -= 1
    flgs[line[0] - 1] += 1
  end
end

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