#include <bits/stdc++.h>
using namespace std;
const int maxm = 50050, maxb = 30;
struct Rect {
  int x1, y1, x2, y2;
  void scan() { scanf("%d%d%d%d", &x1, &y1, &x2, &y2), x2++; }
};
struct Element {
  int x, y1, y2, t;
  Element(int x = 0, int y1 = 0, int y2 = 0, int t = 0)
      : x(x), y1(y1), y2(y2), t(t) {}
  bool operator<(const Element &yy) const { return x < yy.x; }
};
int n, m, K, anss = 0;
Rect r[maxm];
char ans[2][10] = {"Malek", "Hamed"};
int cnt[maxb];
Element p[maxm * 2];
int ps = 0;
int ts = 0, ls[maxm * maxb * 4], rs[maxm * maxb * 4], sum[maxm * maxb * 4],
    cov[maxm * maxb * 4];
inline void update(int x, int len) {
  if (cov[x])
    sum[x] = len;
  else
    sum[x] = sum[ls[x]] + sum[rs[x]];
}
void add(int &x, int ll, int rr, int li, int ri, int k) {
  if (!x) x = ++ts, ls[x] = rs[x] = 0;
  if (li <= ll && rr <= ri)
    cov[x] += k;
  else {
    int mid = (ll + rr) >> 1;
    if (li <= mid) add(ls[x], ll, mid, li, ri, k);
    if (ri > mid) add(rs[x], mid + 1, rr, li, ri, k);
  }
  update(x, rr - ll + 1);
}
int calc() {
  int i, s = 0, root = 0;
  ps = 0;
  for (i = 0; i < m; i++)
    if (r[i].x1 < r[i].x2 && r[i].y1 <= r[i].y2) {
      p[ps++] = Element(r[i].x1, r[i].y1, r[i].y2, 1);
      p[ps++] = Element(r[i].x2, r[i].y1, r[i].y2, -1);
    }
  sort(p, p + ps);
  ts = 0;
  for (i = 0; i < ps; i++) {
    if (i) s += sum[root] * (p[i].x - p[i - 1].x);
    add(root, 1, n, p[i].y1, p[i].y2, p[i].t);
  }
  return s;
}
int main() {
  int i, j;
  scanf("%d%d%d", &n, &m, &K);
  for (i = 0; i < m; i++) r[i].scan();
  for (i = 0; i < maxb; i++) {
    cnt[i] = calc();
    for (j = 0; j < m; j++) {
      if (r[j].x1 & 1) r[j].x1++;
      if (r[j].y1 & 1) r[j].y1++;
      if (r[j].x2 & 1) r[j].x2++;
      r[j].x1 >>= 1;
      r[j].y1 >>= 1;
      r[j].x2 >>= 1;
      r[j].y2 >>= 1;
    }
  }
  for (i = 1; i < maxb; i++) cnt[i - 1] -= cnt[i];
  for (i = maxb - 1; i >= 0 && (1 << i) > K; i--) cnt[i - 1] += cnt[i];
  for (; i >= 0; i--) anss |= cnt[i] & 1;
  printf("%s\n", ans[anss]);
  return 0;
}
