#include <bits/stdc++.h>
using namespace std;
int n, m, K;
struct Rect {
  int x1, y1, x2, y2;
  void read() { scanf("%d%d%d%d", &x1, &y1, &x2, &y2); }
  void turn() {
    x1 = (x1 + 1) / 2;
    y1 = (y1 + 1) / 2;
    x2 = x2 / 2;
    y2 = y2 / 2;
  }
  bool isVaild() { return x1 <= x2 && y1 <= y2; }
} data[100010];
int xcnt, xx[100010 * 2];
map<int, int> xmap;
struct Line {
  int y, x1, x2;
  int val;
} lines[100010 * 2];
bool cmp(const Line &a, const Line &b) { return a.y < b.y; }
struct Segtree {
  int left[100010 * 8], right[100010 * 8], key[100010 * 8];
  int mark[100010 * 8];
  void build(int l, int r, int step) {
    left[step] = l, right[step] = r, key[step] = 0;
    mark[step] = 0;
    if (l + 1 == r) return;
    int mid = l + r >> 1;
    build(l, mid, step * 2);
    build(mid, r, step * 2 + 1);
  }
  void update(int step) {
    if (mark[step])
      key[step] = xx[right[step]] - xx[left[step]];
    else {
      if (left[step] + 1 == right[step])
        key[step] = 0;
      else
        key[step] = key[step * 2] + key[step * 2 + 1];
    }
  }
  void insert(int l, int r, int val, int step) {
    if (l == left[step] && r == right[step]) {
      mark[step] += val;
      update(step);
      return;
    }
    int mid = left[step] + right[step] >> 1;
    if (r <= mid)
      insert(l, r, val, step * 2);
    else if (mid <= l)
      insert(l, r, val, step * 2 + 1);
    else {
      insert(l, mid, val, step * 2);
      insert(mid, r, val, step * 2 + 1);
    }
    update(step);
  }
} tree;
long long cal() {
  xcnt = 0;
  xmap.clear();
  for (int i = 0; i < (m); i++) {
    xx[xcnt++] = data[i].x1;
    xx[xcnt++] = data[i].x2 + 1;
  }
  sort(xx, xx + xcnt);
  xcnt = unique(xx, xx + xcnt) - xx;
  for (int i = 0; i < (xcnt); i++) xmap[xx[i]] = i;
  int cnt = 0;
  for (int i = 0; i < (m); i++) {
    lines[cnt].x1 = xmap[data[i].x1];
    lines[cnt].x2 = xmap[data[i].x2 + 1];
    lines[cnt].y = data[i].y1;
    lines[cnt++].val = 1;
    lines[cnt].x1 = xmap[data[i].x1];
    lines[cnt].x2 = xmap[data[i].x2 + 1];
    lines[cnt].y = data[i].y2 + 1;
    lines[cnt++].val = -1;
  }
  sort(lines, lines + cnt, cmp);
  tree.build(0, xcnt + 1, 1);
  long long ans = 0;
  int last = 0;
  for (int i = 0; i < (cnt); i++) {
    if (i) {
      ans += tree.key[1] * 1ll * (lines[i].y - lines[i - 1].y);
    }
    tree.insert(lines[i].x1, lines[i].x2, lines[i].val, 1);
  }
  return ans;
}
long long ans[100];
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < (m); i++) data[i].read();
  int nn = 0;
  bool result = false;
  for (nn = 0; K; nn++, K >>= 1) {
    if ((ans[nn] = cal()) % 2) result = true;
    for (int i = 0; i < (m); i++) data[i].turn();
    int mm = 0;
    for (int i = 0; i < (m); i++)
      if (data[i].isVaild()) data[mm++] = data[i];
    m = mm;
  }
  printf("%s\n", result ? "Hamed" : "Malek");
  return 0;
}
