#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
using ll = long long;
int n, m, kk, idx, ptr, g[N];
ll ans[40];
struct TNode {
  int l, r, tag, sum;
} t[N << 2];
inline int lc(int pos) { return pos << 1; }
inline int rc(int pos) { return pos << 1 | 1; }
void build(int pos, int l, int r) {
  t[pos].l = l;
  t[pos].r = r;
  t[pos].tag = t[pos].sum = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(lc(pos), l, mid);
  build(rc(pos), mid + 1, r);
}
inline void pushup(int pos) {
  if (t[pos].tag > 0)
    t[pos].sum = g[t[pos].r] - g[t[pos].l - 1];
  else
    t[pos].sum = t[lc(pos)].sum + t[rc(pos)].sum;
}
void modify(int pos, int l, int r, int d) {
  if (t[pos].l == l && t[pos].r == r) {
    t[pos].tag += d;
    pushup(pos);
    return;
  }
  int mid = (t[pos].l + t[pos].r) >> 1;
  if (r <= mid)
    modify(lc(pos), l, r, d);
  else if (l > mid)
    modify(rc(pos), l, r, d);
  else
    modify(lc(pos), l, mid, d), modify(rc(pos), mid + 1, r, d);
  pushup(pos);
}
struct Rec {
  int x1, y1, x2, y2;
} a[N];
struct Border {
  int l, r, pos, tp;
} b[N];
void ins(int x1, int y1, int x2, int y2) {
  if (x1 > x2 || y1 > y2) return;
  g[++idx] = x1 - 1;
  g[++idx] = x2;
  b[++ptr] = {x1, x2, y1, 1};
  b[++ptr] = {x1, x2, y2 + 1, -1};
}
ll solve(int num) {
  idx = ptr = 0;
  ll ans = 0;
  for (int i = 1; i <= m; i++)
    ins((a[i].x1 - 1) / num + 1, (a[i].y1 - 1) / num + 1, a[i].x2 / num,
        a[i].y2 / num);
  if (!idx) return 0;
  sort(g + 1, g + idx + 1);
  idx = unique(g + 1, g + idx + 1) - g - 1;
  for (int i = 1; i <= ptr; i++)
    b[i].l = lower_bound(g + 1, g + idx + 1, b[i].l) - g,
    b[i].r = lower_bound(g + 1, g + idx + 1, b[i].r) - g;
  build(1, 1, idx);
  sort(b + 1, b + ptr + 1, [](Border a, Border b) { return a.pos < b.pos; });
  for (int i = 1, j = 1; i <= ptr; i = j) {
    ans += t[1].sum * (b[i].pos - b[i - 1].pos);
    while (b[i].pos == b[j].pos && j <= ptr)
      modify(1, b[j].l, b[j].r, b[j].tp), ++j;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> kk;
  for (int i = 1; i <= m; i++) cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
  for (int i = 0; i <= 30; i++) ans[i] = solve(1 << i);
  int d = 0;
  while ((1ll << (d + 1)) <= kk) ++d;
  ans[d + 1] = 0;
  for (int i = 0; i <= d; i++)
    if ((ans[i] - ans[i + 1]) & 1) {
      puts("Hamed");
      return 0;
    }
  puts("Malek");
  return 0;
}
