#include<iostream>
#include<string>
#include <algorithm>
using namespace std;

#define p pair<int, int>

struct piar
    {
      int f, l;
      piar()
      {
          f = l = 0;
      }
    };//end struct

bool cmp(piar a, piar b)
      {
          if(a.f != b.f)
            return a.f < b.f;
      //  if(a.l != b.l)
            return a.l > b.l;
      }

int main()
{
    piar arr[100010];
    int n;
    bool flag = true;
    cin >> n;

    for(int i = 0; i < n; i++)//1
        cin >> arr[i].f >> arr[i].l;

    sort(arr, arr + n, cmp);

    //test
    /*for(int i = 0; i < n; i++)
        cout << arr[i].f << " " << arr[i].l << endl;*/

    for(int i = 0; i < n; i++)
        if(arr[i+1].l >= arr[i].l)
        {
            flag = false;
            break;
        }

    if(flag)
        cout << "Happy Alex" << endl;

    if(!flag)
        cout << "Poor Alex" << endl;

}//main


#include<iostream>
#include<string>
#include <algorithm>
using namespace std;

#define p pair<int, int>

struct piar
    {
      int f, l;
      piar()
      {
          f = l = 0;
      }
    };//end struct

bool cmp(piar a, piar b)
      {
          if(a.f != b.f)
            return a.f < b.f;
        if(a.l != b.l)
            return a.l > b.l;
      }

int main()
{
    piar arr[100010];
    int n;
    bool flag = false;
    cin >> n;

    for(int i = 0; i < n; i++)//1
        cin >> arr[i].f >> arr[i].l;

    sort(arr, arr + n, cmp);

    //test
    /*for(int i = 0; i < n; i++)
        cout << arr[i].f << " " << arr[i].l << endl;*/

    for(int i = 0; i < n; i++)
        if(arr[i+1].l < arr[i].l)
        {
            flag = true;
            break;
        }

    if(flag)
        cout << "Happy Alex" << endl;

    if(!flag)
        cout << "Poor Alex" << endl;

}//main


#include <iostream>
#define N 100000
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[N],b[N];
	bool Alex;
	for (int i=1;i<=n;i++)
	{
		cin >> a[i] >> b[i];
	}
	int i=1;
	while (i<=n-1)
	{
		for (int j=i+1;j<=n;j++)
		{
			if (a[i]<a[j] && b[i]>b[j])
			{
				cout << "Happy Alex";
				return 0;
			}
			else
			{
				Alex = false;
			}
		}
		i++;
	}
	if (!Alex)
		cout << "Poor Alex";
	return 0;
}


#include <iostream>
#define N 1000
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[N],b[N];
	bool Alex;
	for (int i=1;i<=n;i++)
	{
		cin >> a[i] >> b[i];
	}
	for (int i=1;i<=n-1;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			if (a[i]<a[j] && b[i]>b[j])
			{
				cout << "Happy Alex";
				return 0;
			}
			else
			{
				Alex = false;
				continue;
			}
		}
	}
	if (!Alex)
		cout << "Poor Alex";
	return 0;
}


#include <iostream>
using namespace std;
int main()
{
	int n,a,b,t;
	cin >> n;
	while (n--)
	{
		cin >> a >> b;
		if (a!=b)
		{cout << "Happy Alex"; return 0;}
	}
	cout << "Poor Alex";
	return 0;
}


#include <iostream>
#define N 100000
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[N],b[N];
	bool Alex;
	for (int i=1;i<=n;i++)
	{
		cin >> a[i] >> b[i];
	}
	for (int i=1;i<=n-1;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			if (a[i]<a[j] && b[i]>b[j])
			{
				cout << "Happy Alex";
				return 0;
			}
			else
			{
				Alex = false;
			}
		}
	}
	if (!Alex)
		cout << "Poor Alex";
	return 0;
}


#include <iostream>
#define N 1000
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[N],b[N];
	bool Alex;
	for (int i=1;i<=n;i++)
	{
		cin >> a[i] >> b[i];
	}
	for (int i=1;i<=n-1;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			if (a[i]<a[j] && b[i]>b[j])
			{
				cout << "Happy Alex";
				return 0;
			}
			else
			{
				Alex = false;
			}
		}
	}
	if (!Alex)
		cout << "Poor Alex";
	return 0;
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

struct MPair
{
	ll a, b, i;
} arr[100010], arr1[100010];

bool cmp1(MPair &a, MPair &b) {
	return a.a < b.a;
}

bool cmp2(MPair &a, MPair &b) {
	return a.b > b.b;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].a >> arr[i].b;
		arr1[i].a = arr[i].a;
		arr1[i].b = arr[i].b;
		arr1[i].i = arr[i].i = i;
	}

	sort(arr, arr + n, cmp1);
	sort(arr1, arr1 + n, cmp2);
	for (int i = 0; i < n; i++) {
		if ((arr[i].a < arr[i + 1].a && arr[i].b > arr[i + 1].b && i + 1 < n) ||
			(arr1[i].a < arr1[i + 1].a && arr1[i].b > arr1[i + 1].b && i + 1 < n) ||

			(arr[i].a > arr[i + 1].a && arr[i].b < arr[i + 1].b && i + 1 < n) ||
			(arr1[i].a > arr1[i + 1].a && arr1[i].b < arr1[i + 1].b && i + 1 < n) ||

			(arr[i].a < arr[i - 1].a && arr[i].b > arr[i - 1].b && i > 0) ||
			(arr1[i].a < arr1[i - 1].a && arr1[i].b > arr1[i - 1].b && i > 0) ||

			(arr[i].a > arr[i - 1].a && arr[i].b < arr[i - 1].b && i > 0) ||
			(arr1[i].a > arr1[i - 1].a && arr1[i].b < arr1[i - 1].b && i > 0) ||

			(arr[i].i != arr1[i].i && (arr[i].a < arr1[i].a && arr[i].b > arr1[i].b))) {
			cout << "Happy Alex";
			return 0;
		}
	}

	cout << "Poor Alex";
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n);
	//sort(arr1, arr1 + n, cmp2);

	if ((arr[0].first < arr[1].first && arr[0].second > arr[1].second) ||
		(arr[0].first > arr[1].first && arr[0].second < arr[1].second)) {
		cout << "Happy Alex";
	}
	else {
		cout << "Poor Alex";
	}
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n);
	//sort(arr1, arr1 + n, cmp2);
	for (int i = 1; i < n; i++) {
		if ((arr[0].first < arr[1].first && arr[0].second > arr[1].second)) {
			cout << "Happy Alex";
			return 0;
		}
	}

	cout << "Poor Alex";
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n);
	//sort(arr1, arr1 + n, cmp2);
	for (int i = 1; i < n; i++) {
		if ((arr[0].first < arr[1].first && arr[0].second > arr[1].second) ||
			(arr[0].first > arr[1].first && arr[0].second < arr[1].second)) {
			cout << "Happy Alex";
			return 0;
		}
	}

	cout << "Poor Alex";
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n);
	//sort(arr1, arr1 + n, cmp2);
	for (int i = 1; i < n; i++) {
		if ((arr[0].first < arr[i].first && arr[0].second > arr[i].second)) {
			cout << "Happy Alex";
			return 0;
		}
	}

	cout << "Poor Alex";
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n, cmp1);
	sort(arr1, arr1 + n, cmp2);

	if ((arr[0].first < arr1[0].first && arr[0].second > arr1[0].second) ||
		(arr[0].first > arr1[0].first && arr[0].second < arr1[0].second)) {
		cout << "Happy Alex";
	}
	else {
		cout << "Poor Alex";
	}
}


#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <ctime>
#include <iomanip>

using namespace std;

typedef long long ll;

ll cnk(ll n, ll k) {
	if (n - k < 0)
		return 0;

	ll res = 1, ik = 2;
	for (ll i = k + 1; i <= n; i++) {
		res *= i;
		if (!(res % ik) && ik <= (n - k)) {
			res /= ik;
			ik++;
		}
	}
	for (ll i = ik; i <= (n - k); i++) {
		res /= i;
	}

	return res;
}

pair<ll, ll> arr[100010], arr1[100010];

bool cmp1(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.first < b.first;
}

bool cmp2(pair<ll, ll> &a, pair<ll, ll> &b) {
	return a.second > b.second;
}

int main() {
	ll n;
	cin >> n;

	for (size_t i = 0; i < n; i++) {
		cin >> arr[i].first >> arr[i].second;
		arr1[i].first = arr[i].first;
		arr1[i].second = arr[i].second;
	}

	sort(arr, arr + n);
	//sort(arr1, arr1 + n, cmp2);
	for (int i = 1; i < n; i++) {
		if ((arr[0].first < arr[i].first && arr[0].second > arr[i].second) ||
			(arr[0].first > arr[i].first && arr[0].second < arr[i].second)) {
			cout << "Happy Alex";
			return 0;
		}
	}

	cout << "Poor Alex";
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include "stdlib.h"
#include <stdio.h>
#pragma warning(disable : 4996)
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int n, s, a, b, k;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	for (int i = 0; i < n; i++) {
		k = i;
		a = x[i];
		b = y[i];
		for (int j = i + 1; j < n; j++)
			if (x[j] < a) {
				k = j; a = x[j]; b = y[j];
			}

		x[k] = x[i]; x[i] = a;
		y[k] = y[i]; y[i] = b;
	}
	int fl = 0;
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			if (y[i]>y[j] && x[i]<x[j]) {
				fl = 1;
				cout << "Happy Alex";
				return 0;
			}
		}
	}
	if (fl == 0)
	cout << "Poor Alex";
	return 0;

}
//int l = 0, m, n, sum = 0;
//long long sum = 0;
//cin >> s1 >> s2;
//	double a=0.0;
//string s1, s2, sum1, sum2;
//	cin >> l >> m >> n;
//int *x = new int[n];
/*for (int i = 0; i < n; i++) {
cin >> x[i];
}*/
//if (s1.find('0') == std::string::npos&&s2.find('0') == std::string::npos)
//sum1.erase(sum1.find('0'), 1);
//sort(x, x + n);
/*for (int j = 0; j < n + m; j++)
cout << z[j] << " ";
*/
//	printf("%.6f", a);
//	cout << "NO";
//	cout << "YES";
// cout << "-1";
//cout << x[5];


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i]>> b[i];
		int fl = 0;
		for (int i = 0; i < n; i++)
			for (int j = i; j < n; j++)
				if (a[j]<a[i] && b[j]>b[i]) {
					fl = 1;
					break;
				}
		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include "stdlib.h"
#include <stdio.h>
#pragma warning(disable : 4996)
using namespace std;

int main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n, a, b, k, fl = 0;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (x[i] != y[i]) {
			fl = 1;
			if (i>0&&((y[i - 1] > y[i] && x[i - 1] < x[i]) || (y[i - 1]<y[i] && x[i - 1]>x[i]))) {
				cout << "Happy Alex";
				return 0;
			}
		}

		else {
			x[i] = 0;
			y[i] = 0;
		}
	}
	if (fl == 0) {
		cout << "Poor Alex";
		return 0;
	}
	else {
		fl = 0;
	}
	for (int i = 0; i < n; i++) {
		k = i;
		a = x[i];
		b = y[i];
		for (int j = i + 1; j < n; j++)
			if (x[j] < a) {
				k = j; a = x[j]; b = y[j];
			}

		x[k] = x[i]; x[i] = a;
		y[k] = y[i]; y[i] = b;
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			if (y[i]>y[j] && x[i]<x[j]) {
				fl = 1;
				cout << "Happy Alex";
				return 0;
			}
		}
	}
	if (fl == 0)
	cout << "Poor Alex";
	return 0;

}
//int l = 0, m, n, sum = 0;
//long long sum = 0;
//cin >> s1 >> s2;
//	double a=0.0;
//string s1, s2, sum1, sum2;
//	cin >> l >> m >> n;
//int *x = new int[n];
/*for (int i = 0; i < n; i++) {
cin >> x[i];
}*/
//if (s1.find('0') == std::string::npos&&s2.find('0') == std::string::npos)
//sum1.erase(sum1.find('0'), 1);
//sort(x, x + n);
/*for (int j = 0; j < n + m; j++)
cout << z[j] << " ";
*/
//	printf("%.6f", a);
//	cout << "NO";
//	cout << "YES";
// cout << "-1";
//cout << x[5];


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include "stdlib.h"
#include <stdio.h>
#pragma warning(disable : 4996)
using namespace std;

int main()
{
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	int n, a, b, k, fl = 0;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (x[i] != y[i])
			fl = 1;
		else {
		    x[i]=0;
		    y[i]=0;
		}
	}
	if (fl == 0) {
		cout << "Poor Alex";
		return 0;
	}
	else {
		fl = 0;
	}
	for (int i = 0; i < n; i++) {
		k = i;
		a = x[i];
		b = y[i];
		for (int j = i + 1; j < n; j++)
			if (x[j] < a) {
				k = j; a = x[j]; b = y[j];
			}

		x[k] = x[i]; x[i] = a;
		y[k] = y[i]; y[i] = b;
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			if (y[i]>y[j] && x[i]<x[j]) {
				fl = 1;
				cout << "Happy Alex";
				return 0;
			}
		}
	}
	if (fl == 0)
	cout << "Poor Alex";
	return 0;

}
//int l = 0, m, n, sum = 0;
//long long sum = 0;
//cin >> s1 >> s2;
//	double a=0.0;
//string s1, s2, sum1, sum2;
//	cin >> l >> m >> n;
//int *x = new int[n];
/*for (int i = 0; i < n; i++) {
cin >> x[i];
}*/
//if (s1.find('0') == std::string::npos&&s2.find('0') == std::string::npos)
//sum1.erase(sum1.find('0'), 1);
//sort(x, x + n);
/*for (int j = 0; j < n + m; j++)
cout << z[j] << " ";
*/
//	printf("%.6f", a);
//	cout << "NO";
//	cout << "YES";
// cout << "-1";
//cout << x[5];


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i]>> b[i];
		int fl = 0;
		for (int i = 0; i < n; i++) {
			int x = a[i];
			for (int j = i; j < n; j++)
				if (a[j]<x && b[j]>b[i]) {
					fl = 1;
					break;
				}
		}

		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int fl = 2;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++) {
			cin >> a[i] >> b[i];
			if (a[i] != b[i])
				fl = 0;
		}

		if (fl == 2) {
			cout << "Poor Alex";
			return 0;
		}

		for (int i = 0; i < n; i++) {
			int x = a[i];
			for (int j = i; j < n; j++)
				if ((a[j]<x && b[j]>b[i])|| (a[j]>x && b[j]<b[i])) {
					fl = 1;
					break;
				}
		}

		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int fl = 2;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++) {
			cin >> a[i] >> b[i];
			if (a[i] != b[i])
				fl = 0;
			else {
				a[i] = 0;
				b[i] = 0;
			}
		}

		if (fl == 2) {
			cout << "Poor Alex";
			return 0;
		}

		for (int i = 0; i < n; i++) {
			if (a[i] == 0)
				continue;
			else {
				int x = a[i];
				for (int j = i; j < n; j++)
					if ((a[j]<x && b[j]>b[i]) || (a[j]>x && b[j]<b[i])) {
						fl = 1;
						break;
					}
			}
		}

		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i];
		for (int i = 0; i < n; i++)
			cin >> b[i];
		int fl = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (a[j]<a[i] && b[j]>b[i]) {
					fl = 1;
					break;
				}
		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include "stdlib.h"
#include <stdio.h>
#pragma warning(disable : 4996)
using namespace std;

int main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n, a, b, k, fl = 0,s=0;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (x[i] != y[i]) {
			fl = 1;
			if (i>0&&((y[i - 1] > y[i] && x[i - 1] < x[i]) || (y[i - 1]<y[i] && x[i - 1]>x[i]))) {
				cout << "Happy Alex";
				return 0;
			}
		}

		else {
			x[i] = 0;
			y[i] = 0;
			s++;
		}
	}
	if (fl == 0) {
		cout << "Poor Alex";
		return 0;
	}
	else {
		fl = 0;
	}
	for (int i = 0; i < n; i++) {
		k = i;
		a = x[i];
		b = y[i];
		for (int j = i + 1; j < n; j++)
			if (x[j] < a) {
				k = j; a = x[j]; b = y[j];
			}

		x[k] = x[i]; x[i] = a;
		y[k] = y[i]; y[i] = b;
	}
	for (int i = s; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			if (y[i]>y[j] && x[i]<x[j]) {
				fl = 1;
				cout << "Happy Alex";
				return 0;
			}
		}
	}
	if (fl == 0)
	cout << "Poor Alex";
	return 0;

}
//int l = 0, m, n, sum = 0;
//long long sum = 0;
//cin >> s1 >> s2;
//	double a=0.0;
//string s1, s2, sum1, sum2;
//	cin >> l >> m >> n;
//int *x = new int[n];
/*for (int i = 0; i < n; i++) {
cin >> x[i];
}*/
//if (s1.find('0') == std::string::npos&&s2.find('0') == std::string::npos)
//sum1.erase(sum1.find('0'), 1);
//sort(x, x + n);
/*for (int j = 0; j < n + m; j++)
cout << z[j] << " ";
*/
//	printf("%.6f", a);
//	cout << "NO";
//	cout << "YES";
// cout << "-1";
//cout << x[5];


#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include "stdlib.h"
#include <stdio.h>
#pragma warning(disable : 4996)
using namespace std;

int main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n, a, b, k, fl = 0;
	cin >> n;
	int *x = new int[n];
	int *y = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (x[i] != y[i])
			fl = 1;
		else {
		    x[i]=0;
		    y[i]=0;
		}
	}
	if (fl == 0) {
		cout << "Poor Alex";
		return 0;
	}
	else {
		fl = 0;
	}
	for (int i = 0; i < n; i++) {
		k = i;
		a = x[i];
		b = y[i];
		for (int j = i + 1; j < n; j++)
			if (x[j] < a) {
				k = j; a = x[j]; b = y[j];
			}

		x[k] = x[i]; x[i] = a;
		y[k] = y[i]; y[i] = b;
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			if (y[i]>y[j] && x[i]<x[j]) {
				fl = 1;
				cout << "Happy Alex";
				return 0;
			}
		}
	}
	if (fl == 0)
	cout << "Poor Alex";
	return 0;

}


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i]>> b[i];
		int fl = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				if (a[j]<a[i] && b[j]>b[i]) {
					fl = 1;
					break;
				}
		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n;
		cin >>n;
		int *a = new int[n];
		int *b = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i]>> b[i];
		int fl = 0;
		for (int i = 0; i < n; i++) {
			int x = a[i];
			for (int j = i; j < n; j++)
				if ((a[j]<x && b[j]>b[i])|| (a[j]>x && b[j]<b[i])) {
					fl = 1;
					break;
				}
		}

		if (fl==1)
			cout << "Happy Alex";
		else
			cout << "Poor Alex";
		return 0;
	}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
    int a, b;
}lap[MAX];
bool cmp(laptop a, laptop b)
{
    return a.b > b.b;
}
int main()
{
    int n;
    int i, j;
    int flag;
    while (scanf("%d", &n) != EOF)
    {
        for (i = 0; i < n; i++)
            scanf("%d", &lap[i].a);
        for (i = 0; i < n; i++)
            scanf("%d", &lap[i].b);
        sort(lap, lap + n, cmp);
        for (i = 0; i < n; i++)
        {
            for (j = i; j < n; j++)
            {
                if (lap[i].a < lap[j].a)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
                break;
        }
        if (flag == 1)
            printf("Happy Alex\n");
        else
            printf("Poor Alex\n");
    }

    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];
bool cmp(laptop a, laptop b)
{
	return a.b > b.b;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		flag = 0;
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].a);
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].b);
		sort(lap, lap + n, cmp);
		for (i = 0; i < n; i++)
		{
			for (j = i+1; j < n; j++)
			{
				if (lap[i].a < lap[j].a)
				{
					flag = 1;
					break;
				}
			}
			if (flag == 1)
				break;
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];

bool cmp(laptop &x, laptop &y)
{
	if (x.a != y.a)
		return x.a > y.a;
	return
		x.b > y.b;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		flag = 0;
		for (i = 0; i < n; i++)
			scanf("%d %d", &lap[i].a,&lap[i].b);
		sort(lap, lap + n,cmp);
		for (i = 0; i < n; i++)
		{
			for (j = i + 1; j < n; j++)
			{
				if (lap[i].a == lap[j].a)
					continue;
				else if (lap[i].b < lap[j].b)
				{
					flag = 1;
					break;
				}
			}
			if (flag == 1)
				break;
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];

bool cmp(laptop x, laptop y)
{
	return y.a <= x.a;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		flag = 0;
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].a);
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].b);
		sort(lap, lap + n,cmp);
		for (i = 0; i < n; i++)
		{
			for (j = i + 1; j < n; j++)
			{
				if (lap[i].b < lap[j].b)
				{
					flag = 1;
					break;
				}
			}
			if (flag == 1)
				break;
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];

bool cmp(laptop &x, laptop &y)
{
	if (x.a != y.a)
		return x.a > y.a;
	return
		x.b > y.b;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		flag = 0;
		for (i = 0; i < n; i++)
			scanf("%d %d", &lap[i].a,&lap[i].b);
		sort(lap, lap + n,cmp);
		for (i = 1; i < n; i++)
		{
			if (lap[i-1].b < lap[i].b)
				{
					flag = 1;
					break;
				}
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication3", "ConsoleApplication3\ConsoleApplication3.vcxproj", "{B5348AE8-B7F7-4273-A865-B772DE651663}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{B5348AE8-B7F7-4273-A865-B772DE651663}.Debug|Win32.ActiveCfg = Debug|Win32
		{B5348AE8-B7F7-4273-A865-B772DE651663}.Debug|Win32.Build.0 = Debug|Win32
		{B5348AE8-B7F7-4273-A865-B772DE651663}.Release|Win32.ActiveCfg = Release|Win32
		{B5348AE8-B7F7-4273-A865-B772DE651663}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];

bool cmp(laptop &x, laptop &y)
{
	if (x.a != y.a)
		return x.a > y.a;
	return
		x.b > y.b;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		flag = 0;
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].a);
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].b);
		sort(lap, lap + n,cmp);
		for (i = 0; i < n; i++)
		{
			for (j = i + 1; j < n; j++)
			{
				if (lap[i].a == lap[j].a)
					continue;
				else if (lap[i].b < lap[j].b)
				{
					flag = 1;
					break;
				}
			}
			if (flag == 1)
				break;
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 100005
struct laptop
{
	int a, b;
}lap[MAX];
bool cmp(laptop a, laptop b)
{
	return a.b > b.b;
}
int main()
{
	int n;
	int i, j;
	int flag;
	while (scanf("%d", &n) != EOF)
	{
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].a);
		for (i = 0; i < n; i++)
			scanf("%d", &lap[i].b);
		sort(lap, lap + n, cmp);
		for (i = 0; i < n; i++)
		{
			for (j = i; j < n; j++)
			{
				if (lap[i].a < lap[j].a)
				{
					flag = 1;
					break;
				}
				else
					flag = 0;
			}
			if (flag == 1)
				break;
		}
		if (flag == 1)
			printf("Happy Alex\n");
		else
			printf("Poor Alex\n");
	}

	return 0;
}


#include <iostream>
#include <set>
using namespace std;

int main()
{
    set<pair<int, int>> data;
    int n, a, b;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        data.insert(pair<int, int>(a, b));
    }
    for (auto it = data.begin(); it != data.end(); it++)
    {
        auto it2 = it;
        it2++;
        for (it2; it2 != data.begin(); it2++)
        {
            if (it->first < it2->first && it->second > it2->second)
            {
                cout << "Happy Alex";
                return 0;
            }
        }
    }
    cout << "Poor Alex";
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int n, a, b;
    cin >> n;
    while (cin >> a >> b)
    {
        if (a != b)
        {
            cout << "Happy Alex";
            return 0;
        }
    }
    cout << "Poor Alex";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	map<int, int> dataA,dataB;
	int n, a, b;
	cin >> n;
	while (	cin >> a >> b)
	{
		dataA[a] = b;
		dataB[b] = a;
	}
	auto itA = dataA.begin();
	auto itB = dataB.rbegin();
	itB++;
	while (itA != dataA.end() && itB != dataB.rend() )
	{
		if (itA->first < itB->first && itA->second > itB->second)
		{
			cout << "Happy Alex";
			return 0;
		}
		itA++;
		itB++;
	}
	cout << "Poor Alex";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
    map<int, int> dataA,dataB;
    int n, a, b;
    cin >> n;
    while ( cin >> a >> b)
    {
        dataA[a] = b;
        dataB[b] = a;
    }
    auto itA = dataA.begin();
    auto itB = dataB.rbegin();
    while (itA != dataA.end() && itB != dataB.rend() )
    {
        if (itA->first < itB->first && itA->second > itB->second)
        {
            cout << "Happy Alex";
            return 0;
        }
        itA++;
        itB++;
    }
    cout << "Poor Alex";
    return 0;
}


#include <iostream>
#include <functional>
#include <set>
using namespace std;

int main()
{
    int n, a, b;
    bool answer = false;
    cin >> n;
    while (cin >> a >> b)
    {
        if (a != b)
            answer = true;
    }
    if (answer)
        cout << "Happy Alex";
    else
        cout << "Poor Alex";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
    map<int, int> dataA,dataB;
    int n, a, b;
    cin >> n;
    while ( cin >> a >> b)
    {
        dataA[a] = b;
        dataB[b] = a;
    }
    auto itA = dataA.begin();
    auto itB = dataB.rbegin();
    while (itB != dataB.rend())
    {
        if (itA->first < itB->first && itA->second > itB->second)
        {
            cout << "Happy Alex";
            return 0;
        }
        itA++;
        if (itA == dataA.end())
        {
            itA = dataA.begin();
            itB++;
        }
    }
    cout << "Poor Alex";
    return 0;
}


#include <iostream>
#include <set>
using namespace std;

int main()
{
    set<pair<int, int>> data;
    int n, a, b;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        data.insert(pair<int, int>(a, b));
    }
    for (auto it = data.begin(); it != data.end(); it++)
    {
        auto it2 = it;
        it2++;
        for (it2; it2 != data.end(); it2++)
        {
            if (it->first < it2->first && it->second > it2->second)
            {
                cout << "Happy Alex";
                return 0;
            }
        }
    }
    cout << "Poor Alex";
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
long long  a,b,c,k,c1,c2;
cin>>c;
long long arr[c];
 for (int i=0;i<c;i++)
 {
   cin>>a>>b>>k;
   if (k%2==0){
     c1=(k/2)*a;
     c2=(k/2)*b;

   }
   else if (k%2!=0)
   {
     c1=((k/2)+1)*a;
     c2=(k/2)*b;
   }
   arr[i]=c1-c2;
 }
 for (int i=0;i<c;i++)
 {
   cout<<arr[i]<<endl;
 }
return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%d",&t);
    while(t--){
        scanf("%ld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(n/2)b*(n-n/2));
    }
    return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%lld",&t);
    while(t--){
        scanf("%lld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(n\2)+b*(n-n\2));
    }
    return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%d",&t);
    while(t--){
        scanf("%ld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(n/2)+b*(n-n/2));
    }
    return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%lld",&t);
    while(t--){
        scanf("%lld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(k/2)+b*(k-k/2));
    }
    return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%lld",&t);
    while(t--){
        scanf("%lld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(k-k/2)-b*(k/2));
    }
    return 0;
}


#include<stdio.h>

long long a,b,k,t;

int main()
{
    scanf("%lld",&t);
    while(t--){
        scanf("%lld%lld%lld",&a,&b,&k);
        printf("%lld\n",a*(n\2)b*(n-n\2));
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int t;
	cin>>t;
	while(t--)
	{
		long long int a,b,k;
		cin>>a>>b>>k;
		  if(k%2!=0)
		  {
		  	x= (((k/2)+1)*a)-((k/2)*b);
		  }
		  else
		  {
		  	x=  ((k/2)*a)-((k/2)*b);
		  }
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	int a,b,k,i;
	cin>>t;
	int ans[t+1],x=0,j;
	for(j=1;j<=t;j++)
	{
		x=0;
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			x=0;
		}
		else if(a==b && k%2!=0)
		{
			x=a;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[j]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i]<<" ";
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	long long int a,b,k;
	cin>>t;
	int x,i;
	while(t--)
	{
		cin>>a>>b>>k;
		  if(k%2!=0)
		  {
		  	x= (((k/2)+1)*a)-((k/2)*b);
		  }
		  else
		  {
		  	x=  ((k/2)*a)-((k/2)*b);
		  }
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	int a,b,k,i;
	cin>>t;
	int ans[t+1],x=0,j;
	for(j=1;j<=t;j++)
	{
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			ans[t]=0;
		}
		else if(a==b && k%2!=0)
		{
			ans[t]=1;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[j]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i]<<" ";
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int t;
	cin>>t;
	long long int x;
	while(t--)
	{
		long long int a,b,k;
		cin>>a>>b>>k;
		x=  (((k+1)/2)*a)-((k/2)*b);
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	int a,b,k,i;
	cin>>t;
	int ans[t+1],x=0,j;
	for(j=1;j<=t;j++)
	{
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			ans[t]=0;
		}
		else if(a==b && k%2!=0)
		{
			ans[t]=1;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[j]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i];
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int t;
	cin>>t;
	long long int x;
	while(t--)
	{
		long long int a,b,k;
		cin>>a>>b>>k;
		x=  ((k+1/2)*a)-((k/2)*b);
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int t;
	cin>>t;
	int x;
	while(t--)
	{
		long long int a,b,k;
		cin>>a>>b>>k;
		x=  ((k+1/2)*a)-((k/2)*b);
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	unsigned long long int a,b,k,i;
	cin>>t;
	int x=0,j;
	unsigned long long int ans[t+1];
	for(j=1;j<=t;j++)
	{
		x=0;
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			x=0;
		}
		else if(a==b && k%2!=0)
		{
			x=a;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[j]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i]<<" ";
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	int a,b,k,i;
	cin>>t;
	int ans[t],x=0;
	while(t--)
	{
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			ans[t]=0;
		}
		else if(a==b && k%2!=0)
		{
			ans[t]=1;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[t]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i];
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	int a,b,k,i;
	cin>>t;
	int ans[t+1],x=0,j;
	for(j=1;j<=t;j++)
	{
		x=0;
		cin>>a>>b>>k;
		if(a==b && k%2==0)
		{
			ans[t]=0;
		}
		else if(a==b && k%2!=0)
		{
			ans[t]=1;
		}
		else
		{
		   for(i=0;i<k;i++)
		   {
			if(i%2==0)
			{
			   x+=a;
			}
			else
			{
				x-=b;
			}
		   }
	      }
		ans[j]=x;
	}
	for(i=1;i<=t;i++)
	{
		cout<<ans[i]<<" ";
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	int x,i;
	while(t--)
	{
		long long int a,b,k;
		cin>>a>>b>>k;
		  if(k%2!=0)
		  {
		  	x= (((k/2)+1)*a)-((k/2)*b);
		  }
		  else
		  {
		  	x=  ((k/2)*a)-((k/2)*b);
		  }
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	long long int a,b,k;
	cin>>t;
	int x,j,i;
	for(j=1;j<=t;j++)
	{
		cin>>a>>b>>k;
		  if(k%2!=0)
		  {
		  	x= (((k/2)+1)*a)-((k/2)*b);
		  }
		  else
		  {
		  	x=  ((k/2)*a)-((k/2)*b);
		  }
		cout<<x<<endl;
	}
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i,0,n){
    lli a,b,k;
    cin >> a >> b >> k;
    cout << -1*k/2*b + (k-k/2)*a << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i,0,n){
    lli a,b,k;
    cin >> a >> b >> k;
    cout << k/2*b + (k-k/2)*a << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i,0,n){
    lli a,b,k;
    cin >> a >> b >> k;
    lli jumps = 0;
    lli x = 0;
    while(jumps <= k){
      if(jumps%2 == 0) x += a;
      else x -= b
      jumps++;
    }
    cout << x << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i.0,n){
    lli a,b,k;
    cin >> a >> b >> k;
    lli jumps = 0;
    lli x = 0;
    while(jumps <= k){
      if(jumps%2 == 0) x += a;
      else x -= b
      jumps++;
    }
    cout << x << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i.,,n){
    lli a,b,k;
    cin >> a >> b >> k;
    lli jumps = 0;
    lli x = 0;
    while(jumps <= k){
      if(jumps%2 == 0) x += a;
      else x -= b
      jumps++;
    }
    cout << x << endl;
  }
  return 0;
}


#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a = b; a < c; a++)
using namespace std;
int main(){
  lli n;
  cin >> n;
  floop(i,0,n){
    lli a,b,k;
    cin >> a >> b >> k;
    lli jumps = 0;
    lli x = 0;
    while(jumps <= k){
      if(jumps%2 == 0) x += a;
      else x -= b;
      jumps++;
    }
    cout << x << endl;
  }
  return 0;
}


#include <iostream>
using namespace std;
int main(){
	int t;
	cin >> t;
	while (t--){
		long long int a,b,k;
		cin >> a >> b >> k;
		long long int even = k/2;
		k-=even;
		cout << k*a-even*b << endl;
	}
}


#include <iostream>
using namespace std;
int main(){
    int t,a,b,k,ans;
    cin >> t;
    for (int i = 0;i<t;t++){
        ans = 0;
        cin >> a >> b >> k;
        for (int i = 0;i<k;i++){
            if (i%2==0){
                ans+=a;
            } else{
                ans-=b;
            }
        }
        cout << ans << endl;
    }
}


#include <iostream>
using namespace std;
int main(){
    int t,a,b,k,ans,ac;
    cin >> t;
    for (int i = 0;i<t;t++){
        ans = 0;
        cin >> a >> b >> k;
        ac = a-b;
        if (k%2!=0){
            for (int i = 0;i<k-1;i+=2){
                ans+=ac;
            }
            ans+=a;
        } else{
            for (int i = 0;i<k;i+=2){
                ans+=ac;
            }
        }
        cout << ans << endl;
    }
}


#include <iostream>
using namespace std;
int main(){
    int t,a,b,k,ans,ac;
    cin >> t;
    for (int i = 0;i<t;t++){
        ans = 0;
        cin >> a >> b >> k;
        ac = a-b;
        for (int i = 0;i<k;i+=2){
            ans+=ac;
        }
        if (k%2==0){
            ans+=a;
        }
        cout << ans << endl;
    }
}


#include <iostream>
using namespace std;
int main(){
    int t,a,b,k,ans,ac;
    cin >> t;
    for (int i = 0;i<t;t++){
        ans = 0;
        cin >> a >> b >> k;
        ac = a-b;
        if (ac == 0){
            cout << ans;
        } else{
            if (k%2!=0){
                for (int i = 0;i<k-1;i+=2){
                    ans+=ac;
                }
                ans+=a;
            } else{
                for (int i = 0;i<k;i+=2){
                    ans+=ac;
                }
            }
        }
        cout << ans << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,k;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>k;
            cout<<(a-b)*(k/2)+a*(k&1)<<"\n";

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,k;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>k;
        cout << (a-b)*1ll*(k/2) + a*(k & 1) << endl;

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,k;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>k;
        if(k%2==0)
        {
            cout<<(a-b)*(k/2)<<"\n";
        }
        else
        {
            cout<<((a-b)*(k/2)+a)<<"\n";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,k;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>k;
        if(k%2==1)
        {
            cout<<(a-b)*(k/2)+a<<"\n";
        }
        else
        {
            cout<<(a-b)*(k/2)<<"\n";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a,b,k;
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>k;
        if(k%2==0)
        {
            cout<<((a-b)*(k/2))<<"\n";
        }
        else
        {
            cout<<((a-b)*(k/2)+a)<<"\n";
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;

    int t;
    cin>>t;
    for (int i=0;i<t;t++){
        cin>>a>>b>>k;
        if(k%2==0){
            cout<<((k/2)*a-(k/2)*b);
            cout<<endl;
        }
        else {
            cout<<(((k/2)+1)*a-(k/2)*b);
            cout<<endl;
        }
    }

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;

    int t;
      cin>>t;
      vector<int> v;
    for (int i=0;i<t;t++){
        cin>>a;
        cin>>b;
        cin>>k;
cout<<(a-b)*(k/2)+a*(k%2);
cout<<endl;
    }

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;

    int t;
      cin>>t;
      vector<int> v;
    for (int i=0;i<t;i++){
        cin>>a;
        cin>>b;
        cin>>k;
cout<<(a-b)*(k/2)+a*(k%2);
cout<<endl;
cout.flush();
    }

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
   long long  int a;

   long long int b;

   long long int k;
vector<long long int> v;
    int t;
      cin>>t;

    for (int i=0;i<t;i++){
        cin>>a;
        cin>>b;
        cin>>k;
v.push_back((a-b)*(k/2)+a*(k%2));
}
for (int i=0;i<t;i++){
    cout<<v[i];
    cout<<endl;
}

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;
vector<int> v;
    int t;
      cin>>t;
      vector<int> v;
    for (int i=0;i<t;i++){
        cin>>a;
        cin>>b;
        cin>>k;
v.push_back((a-b)*(k/2)+a*(k%2));
}
for (int i=0;i<t;i++){
    cout<<v[i];
    cout<<endl;
}

}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int a;
    int b;
    int k;

    int t;
    cin>>t;
    for (int i=0;i<t;t++){
        cin>>a>>b>>k;
        if(k%2==0){
            cout<<((k/2)*a-(k/2)*b);
            cout<<endl;
        }
        else {
            cout<<(((k/2)+1)*a-(k/2)*b);
            cout<<endl;
        }
    }

}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int a;
    int b;
    int k;
vector<int> v;
    int t;
    cin>>t;
    for (int i=0;i<t;t++){
        cin>>a>>b>>k;
        if(k%2==0){
                int x=((k/2)*a-(k/2)*b);
            //v.push_back(x);
cout<<x;
        }
        else {
                int y=(((k/2)+1)*a-(k/2)*b);
           // v.push_back(y);
cout<<y;
        }
    }
//for (int i=0;i<t;i++){
//    cout<<v[i]<<endl;
//}
}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;

    int t;
      cin>>t;
      vector<int> v;
    for (int i=0;i<t;t++){
        cin>>a;
        cin>>b;
        cin>>k;
cout<<(a-b)*(k/2)+a*(k%2);
cout<<endl;
cout.flush();
    }

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;
vector<int> v;
    int t;
      cin>>t;

    for (int i=0;i<t;i++){
        cin>>a;
        cin>>b;
        cin>>k;
v.push_back((a-b)*(k/2)+a*(k%2));
}
for (int i=0;i<t;i++){
    cout<<v[i];
    cout<<endl;
}

}


#include <bits/stdc++.h>
#include<iostream>
using namespace std;

int main() {
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    int b;
    int k;

    int t;
      cin>>t;
      vector<int> v;
    for (int i=0;i<t;t++){
        cin>>a;
        cin>>b;
        cin>>k;
         if(k%2==0){
        int x=k/2;
        cout<<a*x-b*x;
        cout<<endl;
    }
    if(k%2!=0){
        int x=k/2;
        cout<<k*(x+1)-k*x;
        cout<<endl;
    }

    }

}


#include<iostream>
using namespace std;
int main(){
long long e,k,a,b,l=0;
cin>>e;
for(int i=0;i<e;i++)
{
	cin>>a>>b>>k;

	if(k%2==0)

	cout<<(a-b)*(k/2)<<endl;

	else

	cout<<((a-b)*(((k+1)/2)+b)<<endl;

}
}


#include<iostream>
using namespace std;
int main(){
int e,k,a,b;
cin>>e;
for(int i=1;i<e;i++)
{
	cin>>a>>b>>k;
	if(k%2==0)
	cout<<(a-b)*(k/2);

	if(k%2!=0)
	cout<<((a-b)*(k-1))+b;
}

}


#include<iostream>
using namespace std;
int main(){
int e,k,a,b;
cin>>e;
for(int i=1;i<=e;i++)
{
	cin>>a>>b>>k;
	if(k%2==0)
	cout<<(a-b)*(k/2);

	if(k%2!=0)
	cout<<((a-b)*(k-1))+b;
}

}


#include<iostream>
using namespace std;
int main(){
long long e,k,a,b,l=0;
cin>>e;
for(int i=0;i<e;i++)
{
	cin>>a>>b>>k;

	if(k%2==0)

	cout<<(a-b)*(k/2)<<endl;

	else

	cout<<(((a-b)*((k+1)/2)+b))<<endl;

}
}


#include<iostream>
using namespace std;
int main(){
long long e,k,a,b ;
cin>>e;
for(int i=0;i<e;i++)
{
	cin>>a>>b>>k;

	if(k%2==0)

	cout<<(a-b)*(k/2)<<endl;

	else

	cout<<(((a-b)*((k+1)/2)+b))<<endl;

}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,r,l,nj,c;
	c=0;
	cin>>n;
	for(int k=0;k<n;k++)
	{
		cin>>r>>l>>nj;
		if(nj%2==0)
			c=r*(nj/2)-l*(nj/2);
		else
			c=r*((nj/2)+1)-l*(nj/2);
	cout<<c;
	c=0;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long int n,r,l,nj,c;
int main()
{
	c=0;
	cin>>n;
	for(int k=0;k<n;k++)
	{
	cin>>r>>l>>nj;
	for(int i=1;i<nj+1;i++)
	{
		if(nj%2==0)
			c-=l;
		else
			c+=r;
	}
	cout<<c;
	c=0;
}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,r,l,nj,c;
	c=0;
	cin>>n;
	for(int k=0;k<n;k++)
	{
		cin>>r>>l>>nj;
		if(nj%2==0)
			c=r*(nj/2)-l*(nj/2);
		else
			c=r*((nj/2)+1)-l*(nj/2);
	cout<<c<<endl;
	c=0;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,r,l,nj,c;
	c=0;
	cin>>n;
	for(int k=0;k<n;k++)
	{
	cin>>r>>l>>nj;
	for(int i=1;i<nj+1;i++)
	{
		if(i%2==0)
			c-=l;
		else
			c+=r;
	}
	cout<<c;
	c=0;
}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,r,l,nj,c;
	c=0;
	cin>>n;
	for(int k=0;k<n;k++)
	{
	cin>>r>>l>>nj;
	for(int i=1;i<nj+1;i++)
	{
		if(i%2==0)
			c-=l;
		else
			c+=r;
	}
	cout<<c<<endl;
	c=0;
}
}


#include<bits/stdc++.h>
using namespace std;
long long int n,r,l,nj,c;
int main()
{
	cin>>n;
	cin>>r>>l>>nj;
	for(int i=1;i<nj+1;i++)
	{
		if(nj%2==0)
			c-=l;
		else
			c+=r;
	}
	cout<<c;
}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        long int a,b,k;
        long long int ans=0;
        cin>>a>>b>>k;
        for(int j=0;j<k;j++)
        {
            if(j%2)
            ans-=b;
            else
            ans+=a;
        }
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a,b;
        long int k,count=0;
        cin>>a>>b>>k;
        if(k%2)
        count=(k/2)*(a-b)+a;
        else count=(k/2)*(a-b);
        cout<<count<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        long int a,b,k;
        long long int ans=0;
        cin>>a>>b>>k;
        if(k%2)
        ans+=((a-b)*(k/2))+a;
        else
        ans+=((k/2)*(a-b));
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,i,a,b,k;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>a>>b>>k;
        cout<<(a-b)*(k/2)+(k%2)*a<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        long int a,b,k;
        long long int ans=0;
        cin>>a>>b>>k;
        if(k%2)
        {
            int x=k/2;
            ans+=(x*(a-b))+a;
        }
        else
        ans+=((k/2)*(a-b));
        cout<<ans<<endl;
    }
}


#include <iostream>
using namespace std;
int main()
{
   long long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((k%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else if((a==b)&&((k%2)==0))
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   long long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a==b)&&((k%2)==0))
        {
            return 0;
        }
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   long long a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else if((a==b)&&((k%2)==0))
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   signed long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2);
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a);
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2);
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a);
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   int a,b,k;
   cin>>a>>b>>k;
   if((a%2)==0){
        cout<<(a-b)*(k/2);
   }
   else{
       cout<<(((a-b)*((k-1)/2))+a);
   }

}


#include <iostream>
using namespace std;
int main()
{
   long long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else if((a==b)&&((k%2)==0))
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   long long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a==b)&&((k%2)==0))
        {
            cout<<0<<endl;
        }
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   long long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2)<<endl;
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a)<<endl;
        }
   }
}


#include <iostream>
using namespace std;
int main()
{
   unsigned long int a,b,k,t;
   cin>>t;
   for(int i=0;i<t;i++)
   {
        cin>>a>>b>>k;
        if((a%2)==0)
        {
            cout<<(a-b)*(k/2);
        }
        else
        {
            cout<<(((a-b)*((k-1)/2))+a);
        }
   }
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
llong  t;;
cin >> t;
for(int i = 1; i <= t; i++){
   llong a, b, k, sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum << endl;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
llong  t, a, b, k;
cin >> t;
for(int i = 1; i <= t; i++){
    cin >> a >> b >> k;
    int sum = 0;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
SPEEDBOOST;
int t;
cin >> t;
for(int i = 1; i <= t; i++){
    int a, b, k;
    long long  sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum << endl;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
SPEEDBOOST;
long long t;
cin >> t;
for(int i = 1; i <= t; i++){
    long long a, b, k;
    long long  sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum << endl;
}
}


    #include <bits/stdc++.h>
    #define llong long long int
    #define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
    using namespace std;

    int main(){
    SPEEDBOOST;
    long long t;
    cin >> t;
    for(int i = 1; i <= t; i++){
        long long a, b, k;
        cin >> a >> b >> k;
        if(k % 2 == 0){
            cout << endl << (a-b) * abs(k / 2);
        }
        else{
            cout << endl << (a-b) * abs(k/2)+a;
        }
    }
    }


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
llong  t, a, b, k;
cin >> t;
for(int i = 1; i <= t; i++){
    cin >> a >> b >> k;
    int sum = 0;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << endl << sum;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
llong  t, a, b, k;
cin >> t;
for(int i = 1; i <= t; i++){
    cin >> a >> b >> k;
    int sum = 0;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << endl <<
sum;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
llong  t;;
cin >> t;
for(int i = 1; i <= t; i++){
    int a, b, k, sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << endl << sum;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
SPEEDBOOST;
long long t;
cin >> t;
for(int i = 1; i <= t; i++){
    int a, b, k;
    long long  sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum << endl;
}
}


#include <bits/stdc++.h>
#define llong long long int
#define SPEEDBOOST ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
using namespace std;

int main(){
SPEEDBOOST;
int t;
cin >> t;
for(int i = 1; i <= t; i++){
    int a, b, k;
    llong sum = 0;
    cin >> a >> b >> k;
    for(int j = 1; j <= k; j++){
    sum+=a;
    if(j >= k){
        break;
    }
    j+=1;
    sum-=b;
    }
cout << sum << endl;
}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+1)*a-(b*(k/2)))<<endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+1)*a-(b*(k/2))<<endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<(k/2+1)*a-1*(b*(k/2))<<endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    long long a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+k%2)*a-(b*(k/2)))<<endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+k%2)*a-(b*(k/2)))<<endl;
}
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+1)*a-(b*(k/2))<<endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<(k/2+1)*a-1*(b*k/2)<<endl;
}
    return 0;
}


#include<iostream>

using namespace std;

int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++){
    int a,b,k;
    cin>>a>>b>>k;
    cout<<((k/2+1)*a-(b*(k/2))<<endl;
}
    return 0;
}


#include<stdio.h>
int main()
{
    int t,i,sum=0;
    scanf("%d",&t);
    int r[t],l[t],n[t],j,c[t];
    for(i=0;i<t;i++)
    {
        scanf("%d%d%d",&r[i],&l[i],&n[i]);
        for(j=1;j<=n[i];j++)
        {
            if(j%2!=0)
            sum=sum+r[i];
            else
            sum=sum-l[i];
        }
        c[i]=sum;
        sum=0;
    }
    for(i=0;i<t;i++)
    {
        printf("%d\n",c[i]);
    }
}


#include<stdio.h>
int main()
{
    int t,i,c=0,sum=0;
    scanf("%d",&t);
    int r[t],l[t],n[t],j;
    for(i=1;i<=t;i++)
    {
        scanf("%d%d%d",&r[i],&l[i],&n[i]);
        for(j=1;j<=n[i];j++)
        {
            if(j%2!=0)
            sum=sum+r[i];
            else
            sum=sum-l[i];
        }
        printf("%d",sum);
        sum=0;
    }
}


#include<stdio.h>
int main()
{
    int t,i,sum=0;
    scanf("%d",&t);
    int a,b,k,j,c[t];
    for(i=0;i<t;i++)
    {
        scanf("%d%d%d",&a,&b,&k);
        for(j=1;j<=k;j++)
        {
            if(j%2!=0)
            sum=sum+a;
            else
            sum=sum-b;
        }
        c[i]=sum;
        sum=0;
    }
    for(i=0;i<t;i++)
    {
        printf("%d\n",c[i]);
    }
}


#include<iostream>
using namespace std;
int main()
{
    long long int t,i,sum=0;
    cin>>t;
    long long int a,b,k,j;
    while(t--)
    {
        cin>>a>>b>>k;
        int r=k/2;
        int c=k-r;
        sum=(c*a)-(r*b);

        cout<<sum<<"\n";
    }
}


#include<stdio.h>
int main()
{
    int t,i,sum=0;
    scanf("%d",&t);
    int a,b,k,j;
    for(i=0;i<t;i++)
    {
        scanf("%d%d%d",&a,&b,&k);
        for(j=1;j<=k;j++)
        {
            if(j%2!=0)
            sum=sum+a;
            else
            sum=sum-b;
        }
        printf("%d\n",sum);
        sum=0;
    }
}


#include <iostream>

using namespace std;

int main()
{
   long long x,a,b,c;
   long long sumodd=0,sumeven=0;
   cin>>x;
   for(int i=0;i<x;i++)
    {

       cin>>a>>b>>c;
       if(c%2==0)
       {
            sumeven=a*(c/2)-b*(c/2);
            cout<<sumeven<<endl;

       }
       else
       {
            sumodd=a*((c+1)/2)-b*(c/2);
            cout<<sumodd<<endl;
       }
    }
    return 0;

    }


#include<iostream>
using namespace std;
int main()
{
    int x,a,b,c;
    cin>>x;
    long long sum;
    for(int i=0;i<x;i++)
    {
        cin>>a>>b>>c;
        if(c%2==0)
        {
            sum=(a*(c/2))-(b*(c/2));
        cout<<sum;
        }
        else
        {
           sum= (a*((c+1)/2))-(b*(((c+1)/2)-1));
        cout<<sum;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int x,a,b,c;
    cin>>x;
    for(int i=0;i<x;i++)
    {
        cin>>a>>b>>c;
        if(c%2==0)
        cout<<(a*(c/2))-(b*(c/2));
        else
        cout<<(a*((c+1)/2))-(b*(((c+1)/2)-1));
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,x,y,a,b;
	cin >> n;
	for (int i=0;i<n;i++)
	{
		cin >> a >> b;
		if (a>b) x++;
		else if (a<b) y++;
	}
	if (x=y) cout << "Friendship is magic!^^";
	else if (x>y) cout << "Mishka";
	else cout << "Chris";
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,x=0,y=0,a,b;
	cin >> n;
	for (int i=0;i<n;i++)
	{
		cin >> a >> b;
		if (a>b) x++;
		else if (a<b) y++;
	}
	if (x=y) cout << "Friendship is magic!^^";
	else if (x>y) cout << "Mishka";
	else cout << "Chris";
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,x,y;
	cin >> n;
	for (int i=0;i<n;i++)
	{
		cin >> a >> b;
		if (a>b) x++;
		else if (a<b) y++;
	}
	if (x=y) cout << "Friendship is magic!^^";
	else if (x>y) cout << "Mishka";
	else cout << "Chris";
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
int mt,ct;

int main()
{
    int n,m,c;
    cin>>n;
        mt=ct=0;
        for(int i=0;i<n;i++)
        {
            cin>>m>>c;
            if(m>c)
                mt++;
            else if(c>m)
                ct++;
        }
        if(mt==ct)
            cout<<"Friendship is magic!^^"<<endl;
        else if(mt>ct)
            cout<<"Mishka"<<endl;
        else
            cout<<"Chris"<<endl;

}


#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int getsum(int a[],int n)
{
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];
    }
    return sum;
}
int main()
{
    int n;
    scanf("%d",&n);

        int x,y;int sum1=0,sum2=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&x,&y);
            if(x<=0||x>=6)
                exit(0);
            if(y<=0||y>=6)
                exit(0);
            if(x>y)
            {
                sum1++;
            }
            else if(x<y)
                sum2++;

        }

        if(sum1>sum2)
        {
            printf("Mishka");
        }
        else if(sum1<sum2)
        {
            printf("Chris");
        }
        else
        {
            printf("Friendship is magic!^^");
        }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int rounds;
    int m = 0;
    int c = 0;
    cin >> rounds;
    for(int i = 0; i < rounds; ++i)
    {
        int a, b;
        cin >> a >> b;
        if(a > b)
        {
            m++;
        }
        if(a < b)
        {
            c++;
        }
    }
    if(m > c) cout << "Mishka" << endl;
    if(m < c) cout << "Chris" << endl;
    if(m == c) cout << "Friendship is magic!^^" << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int a, b;
	int M=0, C=0;
	cin >> n;
	while (n--) {
		cin >> a >> b;
		if (a==b) {
			M++;
			C++;
		}
		else if (a>b) {
			M++;
		}else if(a<b){
			C++;
		}
	}
	if (M == C)
		cout << "Friendship is magic!^^" << endl;
	else if (M < C)
		cout << "Chris" << endl;
	else if(M > C)
		cout << "Mishka" << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int getsum(int a[],int n)
{
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];
    }
    return sum;
}
int main()
{
    int n;
    while(cin>>n)
    {
        int a[n],b[n];
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&a[i],&b[i]);
        }
        int sum1=getsum(a,n);
        int sum2=getsum(b,n);
        if(sum1>sum2)
        {
            printf("Mishka\n");
        }
        else if(sum1<sum2)
        {
            printf("Chris\n");
        }
        else
        {
            printf("Friendship is magic!^^\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>

using namespace std;

class MishkaandGame
{
private:
    int sum_m,sum_c;
public:
    void init()
    {
        sum_c=0;
        sum_m=0;
    }
    void readscore(int n)
    {
        int mi,cr;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&mi,&cr);
            if(mi>cr)
                sum_m++;
            else if(mi<cr)
                sum_c++;
        }
    }
    void output()
    {
        if(sum_m>sum_c)
            printf("Mishka\n");
        else if(sum_m<sum_c)
            printf("Chris\n");
        else if(sum_m==sum_c)
            printf("Friendship is magic!^^\n");
    }
};
int main()
{
    int n;
    MishkaandGame mg;
    scanf("%d",&n);
    mg.init();
    mg.readscore(n);
    mg.output();
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int num;
    int x,y,tof=0;
    scanf("%d",&num);
    while(num--)
    {
        scanf("%d %d",&x,&y);
        if(x>y) tof++;
        else if(y>x) tof--;
    }
    if(tof==0) cout<<"Friendship is magic!^^"<<endl;
    else if(tof>0) cout<<"Mishka"<<endl;
    else cout<<"Chris"<<endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m, c, Mishka=0, Chris=0;
    scanf("%d", &n);
    while(n--){
        scanf("%d%d", &m, &c);
        if(m>c) Mishka++;
        if(m<c) Chris++;
    }
    if(Mishka>Chris) printf("Mishka\n");
    else if(Mishka<Chris) printf("Chris\n");
    else printf("Friendship is magic!^^\n");
    return 0;
}


#include <iostream>
#include <cstdio>

using namespace std;

int main(){
int NumberOfGame;
scanf("%d", &NumberOfGame);
int mishka, smishka(0);
int chris, schris(0);
for(int i(0); i<NumberOfGame; i++){
    scanf("%d%d", &mishka, &chris);
    if(mishka > chris)smishka++;
    else if(chris > mishka)schris++;
}
if(smishka > schris) printf("Mishka\n");
else if(schris > smishka) printf("Chris\n");
else  printf("Friendship is magic!^^\n");

return 0;
}


#include<cstdio>
#include<cstdlib>
int s=0,p=0,a[10001],b[10001],i,n;
int main() {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(b[i]>a[i]) p++;
	}
	if(s>p) printf("Mishka");
	else printf("Chris");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int s=0,p=0,a[10001],b[10001],i,n;
int main() {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(b[i]>a[i]) p++;
	}
	if(s==p) printf("Friendship is magic!^^");
	else if(s>p) printf("Mishka");
	else printf("Chris");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int n,a[1001],b[1001],s=0,l=0,k=0,i;
int main () {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++)
	if(a[i]==b[i]) k++;
	n=n-k;
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		else l++;
	}
	if(s>l) printf("Mishka");
	else if(l>s) printf("Chris");
	else printf("Friendship is magic!^^");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int n,a[1001],b[1001],s=0,l=0,k=0,i;
int main () {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++)
	if(a[i]==b[i]) k++;
	n=n-k;
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(a[i]<b[i]) l++;
	}
	if(s>l) printf("Mishka");
	else if(l>s) printf("Chris");
	else printf("Friendship is magic!^^");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int s=0,p=0,a[10001],b[10001],i,n;
int main() {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(b[i]>a[i]) p++;
	}
	if(s>p) printf("MIshka");
	else printf("Chris");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int s=0,p=0,a[10001],b[10001],i,n;
int main() {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(b[i]>a[i]) p++;
	}
	if(s==p) printf("Friendship is magic^^");
	else if(s>p) printf("Mishka");
	else printf("Chris");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int n,a[1001],b[1001],s=0,l=0,k=0,i;
int main () {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++)
	if(a[i]==b[i]) k++;
	n=n-k;
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		else l++;
	}

	if(s>l) printf("Mishka");
	else if(l>s) printf("Chris");
	else printf("Friendship is magic!^^");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int n,a[1001],b[1001],s=0,l=0,k=0,i;
int main () {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(a[i]<b[i]) l++;
	}
	if(s>l) printf("Mishka");
	if(l>s) printf("Chris");
	if(l==s) printf("Friendship is magic!^^");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int n,a[1001],b[1001],s=0,l=0,i;
int main () {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		else l++;
	}
	if(s>l) printf("Mishka");
	else if(l>s) printf("Chris");
	else printf("Friendship is magic!^^");
	return 0;
}


#include<cstdio>
#include<cstdlib>
int s=0,p=0,a[10001],b[10001],i,n;
int main() {
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	scanf("%d %d",&a[i],&b[i]);
	for(i=1; i<=n; i++) {
		if(a[i]>b[i]) s++;
		if(b[i]>a[i]) p++;
	}
	if(s>p) printf("Mishka");
	if(s==p) printf("Friendship is magic^^");
	else printf("Chris");
	return 0;
}


#include "iostream"
#include "cstdio"
#include "algorithm"
#include "sstream"
using namespace std;
///////////////////
int main()
{
    int n;string s;
    int chris=0;int mishka=0;
    while(getline(cin,s))
    {
        stringstream te(s);
        te>>n;
        while(n--)
        {
            getline(cin,s);
            stringstream ss(s);
            int a,b;
            ss>>a>>b;
            if(a>b)mishka++;
            else if(a<b)chris++;
        }
        if(chris>mishka)cout<<"Chirs"<<endl;
        else if(mishka>chris)cout<<"Mishka"<<endl;
        else cout<<"Friendship is magic!^^"<<endl;
        chris=mishka=0;
    }
}


#include<iostream>

using namespace std;

int main()
{
    int n;
    int m,c;
    int cnt1=0,cnt2=0;
    cin>>n;
    while(n--)
    {
        cin>>m>>c;
        if(m>c)cnt1++;
        else if(m<c)cnt2++;
    }
    if(cnt1>cnt2)cout<<"Mishka"<<endl;
    else if(cnt1<cnt2)cout<<"Chris"<<endl;
    else cout<<"Friendship is magic!^^"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int n,nm,nc;
    while(scanf("%d",&n)!=EOF)
    {
        nm=0,nc=0;
        for(int i=0;i<n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if(a>b)
                nm++;
            else if(a<b)
                nc++;
        }
        if(nm>nc)
            cout<<"Mishka"<<endl;
        else if(nc>nm)
            cout<<"Chris"<<endl;
        else
            cout<<"Friendship is magic!^^"<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int n;
    int sum1,sum2;
    int a,b;
    while(~scanf("%d",&n)&&n)
    {
        sum1=0;
        sum2=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&a,&b);
            if(a>b)
            {
                sum2++;
            }
            else if(a<b)
            {
                sum1++;
            }
            else
            {
                ;
            }
        }
        if(sum1>sum2)
        {
            printf("Chris\n");
        }
        else if(sum2>sum1)
        {
            printf("Mishka\n");
        }
        else
        {
            printf("Friendship is magic!^^");
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int getsum(int a[],int n)
{
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];
    }
    return sum;
}
int main()
{
    int n;
    scanf("%d",&n);

        int a[n],b[n];
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&a[i],&b[i]);
        }
        int sum1=getsum(a,n);
        int sum2=getsum(b,n);
        if(sum1>sum2)
        {
            printf("Mishka");
        }
        else if(sum1<sum2)
        {
            printf("Chris");
        }
        else
        {
            printf("Friendship is magic!^^");
        }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define debug(x, a, b) for(int (ii)=(a);(ii)<(b);(ii++)) printf("%d: %d\n", ii, x[ii]);

int c1, c2, n;

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a > b) {
      c1++;
    } else if (a < b) {
      c2++;
    }
  }
  if (c1 == c2) {
    cout << "Friendship is magic!^^" << endl;
  } else if (c1 > c2) {
    cout << "Mishka" << endl;
  } else {
    cout << "Chris" << endl;
  }
  return 0;
}


#include "iostream"
#include "sstream"
using namespace std;
///////////////////
int main()
{
    int n;string s;
    int chris=0;int mishka=0;
    getline(cin,s);

        stringstream te(s);
        te>>n;
        while(n--)
        {
            getline(cin,s);
            stringstream ss(s);
            int a,b;
            ss>>a>>b;
            if(a>b)mishka++;
            else if(a<b)chris++;
        }
        if(chris>mishka)cout<<"Chris"<<endl;
        else if(mishka>chris)cout<<"Mishka"<<endl;
        else cout<<"Friendship is magic!^^"<<endl;
        chris=mishka=0;

}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int sum1 = 0;
	int sum2 = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		if (a > b)
		{
			sum1++;
		}
		else if(b<a)
		{
			sum2 ++;
		}
	}
	if (sum1 < sum2)
	{
		printf("Chris\n");
	}
	else if (sum1 == sum2)
	{
		printf("Friendship is magic!^^\n");
	}
	else
	{
		printf("Mishka\n");
	}
    return 0;
}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int sum1 = 0;
	int sum2 = 0;
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		sum1 += a;
		sum2 += b;
	}
	if (sum1 < sum2)
	{
		printf("Chris\n");
	}
	else if (sum1 == sum2)
	{
		printf("Friendship is magic!^^\n");
	}
	else
	{
		printf("Mishka\n");
	}
    return 0;
}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int sum1 = 0;
	int sum2 = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		sum1 += a;
		sum2 += b;
	}
	if (sum1 < sum2)
	{
		printf("Chris\n");
	}
	else if (sum1 == sum2)
	{
		printf("Friendship is magic!^^\n");
	}
	else
	{
		printf("Mishka\n");
	}
    return 0;
}


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int sum1 = 0;
	int sum2 = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		if (a > b)
		{
			sum1++;
		}
		else if(b>a)
		{
			sum2 ++;
		}
	}
	if (sum1 < sum2)
	{
		printf("Chris\n");
	}
	else if (sum1 == sum2)
	{
		printf("Friendship is magic!^^\n");
	}
	else
	{
		printf("Mishka\n");
	}
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cstring>

using namespace std;

typedef long long ll;
const int MAXN = 3e6+100;

int main(){
	int T;
	int a,b;
	int t1=0,t2=0;

	scanf("%d",&T);
	while(T--){
		cin>>a>>b;
		if(a>b)
            t1++;
		else if(a<b)
            t2++;
	}
	if(t1==t2)
        cout<<"Friendship is magic!^^"<<endl;
	else if(t1>t2)
        cout<<"Mishka"<<endl;
	else
        cout<<"Chris"<<endl;

	return 0;
}


#include<cstdio>

int main(){
	int n;

	scanf("%d",&n);
	int m=0,s=0;
	for(int i=0; i<n; i++){
		int l,p;
		scanf("%d %d",&l,&p);
		if(l>p) m++;
		else s++;
	}

	if(m>s) printf("Mishka");
	  else {
	  	if(s==m) printf("Friendship is magic!^^");
	  	else printf("Chris");
	  }
}


#include<cstdio>

int main(){
	int n;

	scanf("%d",&n);
	int m=0,s=0;
	for(int i=0; i<n; i++){
		int l,p;
		scanf("%d %d",&l,&p);
		if(l!=p) {
		  if(l>p) m++;
		    else s++;
		}
	}

	if(m>s) printf("Mishka");
	  else {
	  	if(s==m) printf("Friendship is magic!^^");
	  	else printf("Chris");
	  }

}


#include<cstdio>

int main(){
	int n;

	scanf("%d",&n);
	int m=0,s=0;
	for(int i=0; i<n; i++){
		int l,p;
		scanf("%d %d",&l,&p);
		m=m+l; s=s+p;
	}

	if(m>s) printf("Mishka");
	  else {
	  	if(s==m) printf("Friendship is magic!^^");
	  	else printf("Chris");
	  }
}


#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <deque>
using namespace std;

int main()
{
	int a = 0, b = 0;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int aa, bb;
		cin >> aa >> bb;
		if (aa < bb)
			a++;
		if (aa > bb)
			b++;
	}
	if (a > b)
		cout << "Chris" << endl;
	if (a < b)
		cout << "Mishka" << endl;
	if (a == b)
		cout << "Friendship is magic!^^" << endl;
	return 0;
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")

#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int main()
{
	int n,i,c1=0,c2=0;
	sd(n);
	for(i=0;i<n;++i)
	{
		int x,y;
		sd(x);sd(y);
		if(x>y)
			c1++;
		else if(x<y)
			c2++;
	}
	if(c1>c2)
		printf("Mishka\n");
	else if(c1<c2)
		printf("Chris\n");
	else
		printf("Friendship is magic!^^\n");
}


#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")

#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,x,y;
int ansx,ansy;
int main()
{
	cin>>n;
	for (register int i=1;i<=n;i++)
	{
		cin>>x>>y;
		if (x>y)
		   ansx++;
		else
		   ansy++;
	}
	if (ansx>ansy)
	   cout<<"Mishka"<<endl;
	else if (ansx<ansy)
	   cout<<"Chris"<<endl;
	else
	   cout<<"Friendship is magic!^^"<<endl;
	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else
			c++;
	}
	if(m>c)
		cout<<"Mishka";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else
			c++;
	}
	if(m>c)
		cout<<"Miksha";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else if(a<b)
			c++;
	}
	cout<<m<<" "<<c;
	if(m>c)
		cout<<"Miksha";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else if(a<b)
			c++;
	}
	cout<<m<<" "<<c;
	if(m>c)
		cout<<"Mishka";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else if(a<b)
			c++;
	}
	cout<<m<<" "<<c;
	if(m>c)
		cout<<"Mishka";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <cstdio>
#include <iostream>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <sstream>

using namespace std;
typedef long long int llong;

int main()
{
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
	llong n,m=0,c=0,a,b;
	cin>>n;
	for(llong i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a>b)
			m++;
		else if(a<b)
			c++;
	}

	if(m>c)
		cout<<"Mishka";
	else if(c>m)
		cout<<"Chris";
	else
		cout<<"Friendship is magic!^^";

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,suma = 0,sumb = 0;
    cin >> n;
    int a,b;
    for (int i = 0 ; i < n ; i ++){
        cin >> a >> b;
        if (a > b){
            suma++;
        }
        else if (b > a){
            sumb++;
        }
    }
    if (suma > sumb){
        cout << "Mishka";
    }
    else if (sumb > suma){
        cout << "Chris";
    }
    else {
        cout << "Friendship is magic!^^";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,suma = 0,sumb = 0;
    cin >> n;
    int a[n],b[n];
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i] >> b[i];
        suma += a[i];
        sumb += b[i];
    }
    if (suma > sumb){
        cout << "Mishka";
    }
    else if (sumb > suma){
        cout << "Chris";
    }
    else {
        cout << "Friendship is magic!^^";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,suma,sumb;
    cin >> n;
    int a[n],b[n];
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i] >> b[i];
        suma += a[i];
        sumb += b[i];
    }
    if (suma > sumb){
        cout << "Mishka";
    }
    else if (sumb > suma){
        cout << "Chris";
    }
    else {
        cout << "Friendship is magic!^^";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,suma,sumb;
    cin >> n;
    int a[n],b[n];
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i] >> b[i];
        suma += a[i];
        sumb += b[i];
    }
    if (suma > sumb){
        cout << "Mishka";
    }
    else if (sumb > suma){
        cout << "Chris";
    }
    else {
        cout << "Friendship is magic!^^";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b,c,d;
	while(n--)
	{
		cin>>a>>b;
		if(a>b)
		c++;
		else if(a==b)
		continue;
		else
		d++;
	}
if(c>d)
cout<<"Mishka";
else if(c<d)
cout<<"Chris";
else
cout<<"Friendship is magic!^^";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c=0,d=0;
	long int n;
	cin>>n;
	while(n--)
	{
		cin>>a>>b;
		if(a>b)
		c++;
		else if(a==b)
		break;
		else
		d++;
	}
if(c>d)
cout<<"Mishka";
else if(c<d)
cout<<"Chris";
else
cout<<"Friendship is magic!^^";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b,c=0,d=0;
	cin>>n;
	while(n--)
	{
		cin>>a>>b;
		if(a>b)
		c++;
		else if(a==b)
		break;
		else
		d++;
	}
if(c>d)
cout<<"Mishka";
else if(c<d)
cout<<"Chris";
else
cout<<"Friendship is magic!^^";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c=0,d=0;
	long int n;
	cin>>n;
	while(n--)
	{
		cin>>a>>b;
		if(a>b)
		c++;
		else if(a<b)
		d++;
	}
if(c>d)
cout<<"Mishka";
else if(c<d)
cout<<"Chris";
else
cout<<"Friendship is magic!^^";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c=0,d=0;
	long int n;
	cin>>n;
	while(n--)
	{
		cin>>a>>b;
		if(a>b)
		c++;
		else if(a==b)
		break;
		else
		d++;
	}
if(c>d)
cout<<"Mishka";
else if(c<d)
cout<<"Chris";
else if(c-d==0)
cout<<"Friendship is magic!^^";
return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);

	int mish = 0, ap = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d %d", &a, &b);

		if (a > b) mish++;
		else ap++;
	}

	if (mish > ap) printf("%s\n", "Mishka");
	else if (ap > mish) printf("%s\n", "Chris");
	else printf("%s\n", "Friendship is magic!^^");

	return 0;
}
// 1496340232608


#include <bits/stdc++.h>

using namespace std;

#define TM 3000

int main() {

	int n;
	cin >> n;

	int p1 = 0, p2= 0;
	for(int i = 0; i < n; i++) {
			int a, b;
			cin >> a >> b;
			if(a > b) p1++;
			else if(a < b) p2++;
	}

	if(p1 > p2) cout << "Mishka" << endl;
	else if(p1 < p2) cout << "Chris" << endl;
	else cout << "Friendship is magic!^^" << endl;

	return 0;

}

// 1496337933174


#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);

	int mis = 0; int ch = 0;
	for (int i = 0; i < n; i++) {
		int m,c;
		scanf("%d %d", &m,&c);
		if (m > c) mis++;
		else if (m < c) ch++;
		else {
			mis++;
			ch++;
		}
	}

	if (mis > ch) printf("Mishka\n");
	else if (mis < ch) printf("Chris\n");
	else printf("Friendship is magic!^^\n");

	return 0;
}
// 1496338387468


#include <iostream>
using namespace std;

int main(){
	int n, m[100], c[100];
	int mwin =0, cwin=0;
	cin >> n;
	for (int i =0; i < n; i++){
	cin >> m[i] >> c[i];
	if(m[i] > c[i])
	mwin++;
	else cwin++;
	}
	if (mwin > cwin)
	cout << "Mishka";
	if (mwin < cwin)
	cout << "Chris";
	if (mwin == cwin)
	cout << "Friendship is magic!^^";

	return 0;
}
// 1496339448723


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,c,mc=0,cc=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m>>c;
        if(m>c) mc++;
        else if (m<c) cc++;
    }
    if(mc>cc) cout<<"Mishka";
    else if (cc>mc) cout<<"Chris";
    else cout<<"Friendship is magic!^^";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,c,mc=0,cc=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m>>c;
        if(m>c) mc++;
        else cc++;
    }
    if(mc>cc) cout<<"Mishka";
    else if (cc>mc) cout<<"Chris";
    else cout<<"Friendship is magic!^^";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,c,mc=0,cc=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m>>c;
        if(m>c) mc++;
        else cc++;
    }
    if(mc>cc) cout<<"Mishka";
    else if (cc>mc) cout<<"Chris";
    else cout<<"Friend is magic!^^";
}


#include<iostream>
using namespace std;
int main(){
	int n,a,b,ac=0,len;
	cin>>n;
	len=n;
	while(len--){
		cin>>a>>b;
		if(a>b)ac++;
		if(a==b)n--;
	}
	if(n==2*ac){
		cout<<"Friendship is magic!^^"<<endl;
	}else if(2*ac<n){
		cout<<"Chris"<<endl;
	}else{
		cout<<"Mishka"<<endl;
	}
}


#include<iostream>
using namespace std;
int main(){
	int n,a,b,ac,len;
	cin>>n;
	len=n;
	while(len--){
		cin>>a>>b;
		if(a>b)ac++;
		if(a==b)n--;
	}
	if(n==2*ac){
		cout<<"Friendship is magic!^^"<<endl;
	}else if(2*ac<n){
		cout<<"Chris"<<endl;
	}else{
		cout<<"Mishka"<<endl;
	}
}


#include<iostream>
using namespace std;
int main(){
	int n,a,b,ac,len;
	cin>>n;
	len=n;
	while(len--){
		cin>>a>>b;
		if(a>b)ac++;
		if(a==b)n--;
	}
	if(n%ac==0){
		cout<<"Friendship is magic!^^"<<endl;
	}else if(2*ac<n){
		cout<<"Chris"<<endl;
	}else{
		cout<<"Mishka"<<endl;
	}
}


#include <iostream>

using namespace std;

int main(){

	int numJogadas;

	cin >> numJogadas;

	int mishka = 0;
	int chris = 0;

	int num1, num2;

	for(int i=0; i < numJogadas; i++){
		cin >> num1;
		cin >> num2;

		if(num1 == num2){
			mishka += 1;
			chris += 1;
		}else if( num1 > num2){
			mishka += 1;
		}else{
			chris += 1;
		}
	}

	if(mishka == chris){
		cout << "Friendship is magic!^^" << endl;
	}else if( mishka > chris){
		cout << "Mishka" << endl;
	}else{
		cout << "Chris" << endl;
	}
}
// 1496340584853


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, r_m = 0, r_c = 0, m, c;
    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>m>>c;

        if(m > c){
            r_m++;
        }else if(m < c){
            r_c++;
        }
    }

    if(r_m > r_c){
        cout<<"Mishka";
    }else if(r_m < r_c){
        cout<<"Chris";
    }else{
        cout<<"Friendship is magic!^^";
    }
	return 0;
}

// 1496340779753


#include <stdio.h>
int main ()
{
	int n,m[100],c[100],i,a=0,b=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&m[i],&c[i]);
		if(m[i]>c[i])
			a++;
		else if(m[i]<c[i])
			b++;
	}
		if(a>b)
			printf("Mishka");
		else if(a<b)
			printf("Chris");
		else
			printf("Friendship is magic!^^");
}

// 1471694847501


#include <iostream>
using namespace std;

int main(){
	int n, m[100], c[100];
	int mwin =0, cwin=0;
	cin >> n;
	for (int i =0; i < n; i++){
	cin >> m[i] >> c[i];
	if(m[i] > c[i])
	mwin++;
	else if (m[i]== c[i]){}
	else
	cwin++;
	}
	if (mwin > cwin)
	cout << "Mishka" << endl;
	if (mwin < cwin)
	cout << "Chris" << endl;
	if (mwin == cwin)
	cout << "Friendship is magic!^^" << endl;

	return 0;
}
// 1496339888884


#include <iostream>
using namespace std;
int main() {
    int summ=0, rolls, mish, chris;
    cin >> rolls;
    for(int i = 0; i < rolls; i++) {
        cin >> mish >> chris;
        if(mish > chris) {
            summ += 1;
        } else if(chris > mish) {
            summ -= 1;
        }
    }

    if(summ > 0){
        cout << "Mishka";
    } else if(summ < 0){
        cout << "Chris";
    } else {
        cout << "Friendship is magic!^^";
    }
    return 0;
}

// 1496371772162


#include <iostream>

using namespace std;

int main(){

	int numJogadas;

	cin >> numJogadas;

	int mishka = 0;
	int chris = 0;

	int num1, num2;

	for(int i=0; i < numJogadas; i++){
		cin >> num1;
		cin >> num2;

		mishka += num1;
		chris += num2;

	}

	if(mishka == chris){
		cout << "Friendship is magic!^^" << endl;
	}else if( mishka > chris){
		cout << "Mishka" << endl;
	}else{
		cout << "Chris" << endl;
	}
}
// 1496340321210


#include <iostream>
using namespace std;
int main()
{
	int n,a,b,mishka=0,chris=0;
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		cin>>a>>b;
		if (a>b)
		mishka++;
		else if(a==b)
		{mishka++;chris++;}
		else if(a<b)
		chris++;
	}
	if (mishka>chris)
	cout<<"Mishka"<<endl;
	else if(mishka>chris)
	cout<<"Chris"<<endl;
	else if(mishka==chris)
	cout<<"Friendship is magic!^^"<<endl;
}


#include <iostream>
using namespace std;
int main()
{
	int n,a,b,mishka=0,chris=0;
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		cin>>a>>b;
		if (a>b)
		mishka++;
		else if(a==b)
		{mishka++;chris++;}
		else if(a<b)
		chris++;
	}
	if (mishka>chris)
	cout<<"Mishka"<<endl;
	else if(mishka<chris)
	cout<<"Chris"<<endl;
	else if(mishka==chris)
	cout<<"Friendship is magic!^^"<<endl;
}


#include <iostream>
using namespace std;
int main()
{
	int n,a,b,mishka,chris,good;
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		cin>>a>>b;
		if (a>b)
		mishka++;
		else if(a==b)
		good++;
		else
		chris++;
	}
	if (mishka==chris)
	cout<<"Mishka";
	else if(chris>mishka)
	cout<<"Chris";
	else if(mishka>chris)
	cout<<"Friendship is magic!^^";
	else
	cout<<"Friendship is magic!^^";
}