# frozen_string_literal: true X, N, M = gets.chomp.split.map(&:to_i) AS = gets.chomp.split.map(&:to_i) BS = gets.chomp.split.map(&:to_i) mr_max = AS.include?(X) max_valu = BS.include?(X) puts(if mr_max && max_valu 'MrMaxValu' elsif mr_max 'MrMax' elsif max_valu 'MaxValu' else -1 end)