{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"Linus from the Linus Tech Tips Youtube channel decided to make his own custom **RGB** keyboard.\nTo make his keyboard unique, he decided that no two neighboring keys would have the same color. \nSince **RGB** keyboards light up, they consume electricity. \nSince it was Linus’s first time making his own keyboard from scratch, he messed up the wiring in a way that *each color in each key consumes a different amount of electricity per month*.\n\nGiven how much electricity each color consumes for every key, determine the most **cost-efficient** way for him to choose the colors for each key in his **RGB** keyboard."}},{"title":"Input","value":{"format":"MD","content":"The first line of input contains an integer $$$t$$$ $$$(1\u003c\u003dt\u003c\u003d100)$$$\nWhich determines the number of test cases.\n\nEach test case starts with a blank line, following an integer $$$n$$$ which determines how many keys there are in Linus’s keyboard.\n\nAfterward, you will be given $$$n$$$ lines with 3 integers each, describing how much electricity it’ll consume if you decide to go with the colors $$$R(red)$$$, $$$G(green)$$$, and $$$B(blue)$$$ **respectively**. \n\n$$$(1\u003c\u003dRGB\u003c\u003d1000)$$$\n"}},{"title":"Output","value":{"format":"MD","content":"How much electricity the keyboard would consume if you choose the _optimal_ color for each key. "}},{"title":"Sample","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\n4\n13 23 12\n77 36 64\n44 89 76\n31 78 45\n\n3\n26 40 83\n49 60 57\n13 89 99\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 137\nCase 2: 96\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Reminder","value":{"format":"MD","content":"No two neighboring keys can have the same color!\nSo, a keyboard can have the following keys:\nRed Green Red\nBut can’t have \nRed Red Green\n"}}]}