using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "Input4";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2");
            WillReturn.Add("4 2");
            WillReturn.Add("4 0.4000000");
            WillReturn.Add("3 0.5000000");
            WillReturn.Add("4 1");
            WillReturn.Add("5 0.3333333");
            WillReturn.Add("5 3");
            WillReturn.Add("5 0.7777777");
            WillReturn.Add("4 0.1111111");
            WillReturn.Add("2 0.0001111");
            //YES
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2");
            WillReturn.Add("4 2");
            WillReturn.Add("4 0.5000000");
            WillReturn.Add("3 0.4000000");
            WillReturn.Add("4 1");
            WillReturn.Add("5 0.3333333");
            WillReturn.Add("5 3");
            WillReturn.Add("8 0.7777777");
            WillReturn.Add("4 0.1111111");
            WillReturn.Add("2 0.0001111");
            //NO
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("2");
            WillReturn.Add("4 1");
            WillReturn.Add("92 0.20196366");
            WillReturn.Add("6 5");
            WillReturn.Add("79 0.08583218");
            WillReturn.Add("80 0.07624386");
            WillReturn.Add("54 0.08860646");
            WillReturn.Add("54 0.00863427");
            WillReturn.Add("19 0.03857239");
            WillReturn.Add("6 2");
            WillReturn.Add("17 0.22365747");
            WillReturn.Add("20 0.18743152");
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2363
    static void Main()
    {
        List<string> InputList = GetInputList();

        var DiceDictList = new List<Dictionary<decimal, decimal>>();

        int CurrY = 1;

        decimal[] wkArr = { };
        Action SplitAct = () =>
            wkArr = InputList[CurrY].Split(' ').Select(X => decimal.Parse(X)).ToArray();

        while (CurrY <= InputList.Count - 1) {
            SplitAct();
            decimal MenCnt = wkArr[1];

            var WillAddDict = new Dictionary<decimal, decimal>();
            for (int I = 1; I <= MenCnt; I++) {
                CurrY++;
                SplitAct();
                if (WillAddDict.ContainsKey(wkArr[0])) {
                    WillAddDict[wkArr[0]] += wkArr[1];
                }
                else WillAddDict.Add(wkArr[0], wkArr[1]);
            }
            DiceDictList.Add(WillAddDict);
            CurrY++;
        }

        //DebugDiceInfoPrint(DiceDictList);

        //班長のダイス
        Dictionary<decimal, decimal> HantyouDiceDict = DiceDictList.Last();

        //カイジのダイスのList
        DiceDictList.RemoveAt(DiceDictList.Count - 1);
        var KaijiDiceDictList = DiceDictList;

        decimal KaijiKitaiti = KaijiDiceDictList.Max(X => DeriveDiceKitaiti(X));
        decimal HantyouKitaiti = DeriveDiceKitaiti(HantyouDiceDict);
        Console.WriteLine(KaijiKitaiti > HantyouKitaiti ? "YES" : "NO");
    }

    //デバッグ用でダイス情報を表示
    static void DebugDiceInfoPrint(List<Dictionary<decimal, decimal>> pDiceDictList)
    {
        for (int I = 0; I <= pDiceDictList.Count - 1; I++) {
            Console.WriteLine(new string('■', 20));
            Console.WriteLine("{0}個目のダイス情報", I + 1);
            foreach (var EachPair in pDiceDictList[I]) {
                Console.WriteLine("{0}が出る確率が{1}",
                    EachPair.Key, EachPair.Value);
            }
            Console.WriteLine("期待値={0}", DeriveDiceKitaiti(pDiceDictList[I]));
        }
    }

    //ダイスの期待値を求める
    static decimal DeriveDiceKitaiti(Dictionary<decimal, decimal> pDiceDict)
    {
        decimal WillReturn = 0;
        decimal BunboSum = pDiceDict.Values.Sum();
        foreach (var EachPair in pDiceDict) {
            WillReturn += EachPair.Key * EachPair.Value / BunboSum;
        }
        return WillReturn;
    }
}

Measured memory_bytes: 20940