#include <bits/stdc++.h>
using namespace std;
int ans;
int k;
int n;
const int N = (int)6e4;
long long x[N][2], y[N][2];
struct Event {
  long long x, y1, y2;
  bool type;
  Event() : x(), y1(), y2(), type() {}
  Event(long long _x, long long _y1, long long _y2, bool _type)
      : x(_x), y1(_y1), y2(_y2), type(_type) {}
  bool operator<(const Event &a) const { return x < a.x; }
};
Event ev[3 * N];
int ev_sz;
long long ys[3 * N];
int m;
struct Node {
  int l, r;
  int min;
  int cnt_min;
  int add;
  Node() : l(0), r(0), min(0), cnt_min(0), add(0) {}
  Node(int l, int r, int min, int cnt_min, int add)
      : l(l), r(r), min(min), cnt_min(cnt_min), add(add) {}
};
const int MOD = 1 << 17;
Node tree[2 * MOD];
void update(int v) {
  if (v >= MOD) throw;
  tree[v].min = min(tree[2 * v].min, tree[2 * v + 1].min);
  tree[v].cnt_min = 0;
  for (int i = 0; i < 2; i++)
    if (tree[v].min == tree[2 * v + i].min)
      tree[v].cnt_min += tree[2 * v + i].cnt_min;
  return;
}
void push(int v) {
  if (v >= MOD) throw;
  int val = tree[v].add;
  tree[v].add = 0;
  for (int i = 0; i < 2; i++) {
    tree[2 * v + i].add += val;
    tree[2 * v + i].min += val;
  }
  return;
}
void buildTree() {
  for (int i = 0; i < MOD; i++) {
    if (i < m) {
      int dy = 0;
      if (i < m - 1) dy = (int)(ys[i + 1] - ys[i]);
      tree[i + MOD] = Node(i, i + 1, 0, dy, 0);
    } else
      tree[i + MOD] = Node(i, i + 1, 0, 0, 0);
  }
  for (int i = MOD - 1; i > 0; i--) {
    tree[i] = Node(tree[2 * i].l, tree[2 * i + 1].r, 0, 0, 0);
    update(i);
  }
  return;
}
void addOnSegm(int v, int l, int r, int val) {
  if (l >= tree[v].r || r <= tree[v].l) return;
  if (l <= tree[v].l && tree[v].r <= r) {
    tree[v].add += val;
    tree[v].min += val;
    return;
  }
  push(v);
  for (int i = 0; i < 2; i++) addOnSegm(2 * v + i, l, r, val);
  update(v);
  return;
}
int getSq() {
  int res = (int)(ys[m - 1] - ys[0]);
  if (tree[1].min == 0) res -= tree[1].cnt_min;
  return res;
}
int getC(int x, int lvl) { return ((x - 1) >> lvl) + 1; }
long long solve(int lvl) {
  long long res = 0LL;
  ev_sz = 0;
  m = 0;
  for (int i = 0; i < n; i++) {
    ev[ev_sz++] =
        Event(getC(x[i][0], lvl), getC(y[i][0], lvl), getC(y[i][1], lvl), true);
    ev[ev_sz++] = Event(getC(x[i][1], lvl), getC(y[i][0], lvl),
                        getC(y[i][1], lvl), false);
    ys[m++] = getC(y[i][0], lvl);
    ys[m++] = getC(y[i][1], lvl);
  }
  sort(ys, ys + m);
  m = unique(ys, ys + m) - ys;
  buildTree();
  sort(ev, ev + ev_sz);
  for (int i = 0; i < ev_sz; i++) {
    int yl = lower_bound(ys, ys + m, ev[i].y1) - ys;
    int yr = lower_bound(ys, ys + m, ev[i].y2) - ys;
    long long dx = ev[i].x - ev[i - 1].x;
    if (i != 0) res += dx * getSq();
    addOnSegm(1, yl, yr, ev[i].type ? 1 : -1);
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &n, &k);
  int tmp = 0;
  while ((1 << tmp) <= k) tmp++;
  k = tmp;
  ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%I64d%I64d%I64d%I64d", &x[i][0], &y[i][0], &x[i][1], &y[i][1]);
    x[i][1]++;
    y[i][1]++;
  }
  for (int i = 0; i < k; i++)
    if (solve(i) & 1LL) {
      printf("Hamed\n");
      return 0;
    }
  printf("Malek\n");
  return 0;
}

### Prompt

Generate a cpp solution to the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int ans;
int k;
int n;
const int N = (int)6e4;
long long x[N][2], y[N][2];
struct Event {
  long long x, y1, y2;
  bool type;
  Event() : x(), y1(), y2(), type() {}
  Event(long long _x, long long _y1, long long _y2, bool _type)
      : x(_x), y1(_y1), y2(_y2), type(_type) {}
  bool operator<(const Event &a) const { return x < a.x; }
};
Event ev[3 * N];
int ev_sz;
long long ys[3 * N];
int m;
struct Node {
  int l, r;
  int min;
  int cnt_min;
  int add;
  Node() : l(0), r(0), min(0), cnt_min(0), add(0) {}
  Node(int l, int r, int min, int cnt_min, int add)
      : l(l), r(r), min(min), cnt_min(cnt_min), add(add) {}
};
const int MOD = 1 << 17;
Node tree[2 * MOD];
void update(int v) {
  if (v >= MOD) throw;
  tree[v].min = min(tree[2 * v].min, tree[2 * v + 1].min);
  tree[v].cnt_min = 0;
  for (int i = 0; i < 2; i++)
    if (tree[v].min == tree[2 * v + i].min)
      tree[v].cnt_min += tree[2 * v + i].cnt_min;
  return;
}
void push(int v) {
  if (v >= MOD) throw;
  int val = tree[v].add;
  tree[v].add = 0;
  for (int i = 0; i < 2; i++) {
    tree[2 * v + i].add += val;
    tree[2 * v + i].min += val;
  }
  return;
}
void buildTree() {
  for (int i = 0; i < MOD; i++) {
    if (i < m) {
      int dy = 0;
      if (i < m - 1) dy = (int)(ys[i + 1] - ys[i]);
      tree[i + MOD] = Node(i, i + 1, 0, dy, 0);
    } else
      tree[i + MOD] = Node(i, i + 1, 0, 0, 0);
  }
  for (int i = MOD - 1; i > 0; i--) {
    tree[i] = Node(tree[2 * i].l, tree[2 * i + 1].r, 0, 0, 0);
    update(i);
  }
  return;
}
void addOnSegm(int v, int l, int r, int val) {
  if (l >= tree[v].r || r <= tree[v].l) return;
  if (l <= tree[v].l && tree[v].r <= r) {
    tree[v].add += val;
    tree[v].min += val;
    return;
  }
  push(v);
  for (int i = 0; i < 2; i++) addOnSegm(2 * v + i, l, r, val);
  update(v);
  return;
}
int getSq() {
  int res = (int)(ys[m - 1] - ys[0]);
  if (tree[1].min == 0) res -= tree[1].cnt_min;
  return res;
}
int getC(int x, int lvl) { return ((x - 1) >> lvl) + 1; }
long long solve(int lvl) {
  long long res = 0LL;
  ev_sz = 0;
  m = 0;
  for (int i = 0; i < n; i++) {
    ev[ev_sz++] =
        Event(getC(x[i][0], lvl), getC(y[i][0], lvl), getC(y[i][1], lvl), true);
    ev[ev_sz++] = Event(getC(x[i][1], lvl), getC(y[i][0], lvl),
                        getC(y[i][1], lvl), false);
    ys[m++] = getC(y[i][0], lvl);
    ys[m++] = getC(y[i][1], lvl);
  }
  sort(ys, ys + m);
  m = unique(ys, ys + m) - ys;
  buildTree();
  sort(ev, ev + ev_sz);
  for (int i = 0; i < ev_sz; i++) {
    int yl = lower_bound(ys, ys + m, ev[i].y1) - ys;
    int yr = lower_bound(ys, ys + m, ev[i].y2) - ys;
    long long dx = ev[i].x - ev[i - 1].x;
    if (i != 0) res += dx * getSq();
    addOnSegm(1, yl, yr, ev[i].type ? 1 : -1);
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &n, &k);
  int tmp = 0;
  while ((1 << tmp) <= k) tmp++;
  k = tmp;
  ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%I64d%I64d%I64d%I64d", &x[i][0], &y[i][0], &x[i][1], &y[i][1]);
    x[i][1]++;
    y[i][1]++;
  }
  for (int i = 0; i < k; i++)
    if (solve(i) & 1LL) {
      printf("Hamed\n");
      return 0;
    }
  printf("Malek\n");
  return 0;
}

```