During the last 24 hours Hamed and Malek spent all their time playing "Sharti". Now they are too exhausted to finish the last round. So they asked you for help to determine the winner of this round. 

"Sharti" is played on a n × n board with some of cells colored white and others colored black. The rows of the board are numbered from top to bottom using number 1 to n. Also the columns of the board are numbered from left to right using numbers 1 to n. The cell located at the intersection of i-th row and j-th column is denoted by (i, j).

The players alternatively take turns. In each turn the player must choose a square with side-length at most k with its lower-right cell painted white. Then the colors of all the cells in this square are inversed (white cells become black and vice-versa). The player who cannot perform a move in his turn loses. 

You know Hamed and Malek are very clever and they would have played their best moves at each turn. Knowing this and the fact that Hamed takes the first turn, given the initial board as described in the input, you must determine which one of them will be the winner.

Input

In this problem the initial board is specified as a set of m rectangles. All cells that lie inside at least one of these rectangles are colored white and the rest are colored black.

In the first line of input three space-spereated integers n, m, k (1 ≤ k ≤ n ≤ 109, 1 ≤ m ≤ 5·104) follow, denoting size of the board, number of rectangles and maximum size of the turn square during the game, respectively.

In i-th line of the next m lines four space-seperated integers ai, bi, ci, di (1 ≤ ai ≤ ci ≤ n, 1 ≤ bi ≤ di ≤ n) are given meaning that i-th rectangle determining the initial board is a rectangle with upper-left cell at (ai, bi) and lower-right cell at (ci, di).

Output

If Hamed wins, print "Hamed", otherwise print "Malek" (without the quotes).

Examples

Input

5 2 1
1 1 3 3
2 2 4 4


Output

Malek


Input

12 5 7
3 4 5 6
1 2 1 2
4 5 9 9
8 6 12 10
12 4 12 4


Output

Hamed
#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
struct node {
  int x, l, r, t;
  node(int x = 0, int l = 0, int r = 0, int t = 0) : x(x), l(l), r(r), t(t) {}
  bool operator<(const node& a) const { return x < a.x; }
} a[N];
int tag[N * 60], sm[N * 60], lc[N * 60], rc[N * 60], q1, q2, q3, clk;
void ps(int o, int l, int r) {
  if (tag[o])
    sm[o] = (l - 1) ^ r;
  else
    sm[o] = sm[lc[o]] ^ sm[rc[o]];
}
void modify(int& o, int l, int r) {
  if (!o) o = ++clk;
  if (q1 <= l && r <= q2) {
    tag[o] += q3;
    return ps(o, l, r);
  }
  int mid = (l + r) / 2;
  if (q1 <= mid) modify(lc[o], l, mid);
  if (q2 > mid) modify(rc[o], mid + 1, r);
  ps(o, l, r);
}
int rt, ans, K;
void solve(int l, int r) {
  int tmp = ((l - 1) ^ r) & sm[rt];
  for (int i = 0; i < 30; ++i)
    if (tmp >> i & 1) {
      ans ^= min(K, 1 << i);
      if (i) ans ^= min(K, 1 << (i - 1));
    }
}
int n, m, cnt;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> K;
  for (; K & (K - 1); K &= K - 1)
    ;
  for (int i = 1; i <= m; ++i) {
    int xl, xr, yl, yr;
    cin >> xl >> yl >> xr >> yr;
    a[++cnt] = node(xl, yl, yr, 1);
    a[++cnt] = node(xr + 1, yl, yr, -1);
  }
  sort(a + 1, a + cnt + 1);
  for (int i = 1; i <= cnt; ++i) {
    if (a[i].x != a[i - 1].x) solve(a[i - 1].x, a[i].x - 1);
    q1 = a[i].l;
    q2 = a[i].r;
    q3 = a[i].t;
    modify(rt, 1, n);
  }
  cout << (ans ? "Hamed\n" : "Malek\n");
  return 0;
}
