Problem: This is an interactive problem.

You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to x.

More formally, there is a singly liked list built on an array of n elements. Element with index i contains two integers: valuei is the integer value in this element, and nexti that is the index of the next element of the singly linked list (or -1, if the current element is the last). The list is sorted, i.e. if nexti ≠ - 1, then valuenexti > valuei.

You are given the number of elements in the list n, the index of the first element start, and the integer x.

You can make up to 2000 queries of the following two types:

  * ? i (1 ≤ i ≤ n) — ask the values valuei and nexti, 
  * ! ans — give the answer for the problem: the minimum integer, greater than or equal to x, or ! -1, if there are no such integers. Your program should terminate after this query. 



Write a program that solves this problem.

Input

The first line contains three integers n, start, x (1 ≤ n ≤ 50000, 1 ≤ start ≤ n, 0 ≤ x ≤ 109) — the number of elements in the list, the index of the first element and the integer x.

Output

To print the answer for the problem, print ! ans, where ans is the minimum integer in the list greater than or equal to x, or -1, if there is no such integer.

Interaction

To make a query of the first type, print ? i (1 ≤ i ≤ n), where i is the index of element you want to know information about.

After each query of type ? read two integers valuei and nexti (0 ≤ valuei ≤ 109,  - 1 ≤ nexti ≤ n, nexti ≠ 0).

It is guaranteed that if nexti ≠ - 1, then valuenexti > valuei, and that the array values give a valid singly linked list with start being the first element.

Note that you can't ask more than 1999 queries of the type ?.

If nexti = - 1 and valuei = - 1, then it means that you asked more queries than allowed, or asked an invalid query. Your program should immediately terminate (for example, by calling exit(0)). You will receive "Wrong Answer", it means that you asked more queries than allowed, or asked an invalid query. If you ignore this, you can get other verdicts since your program will continue to read from a closed stream.

Your solution will get "Idleness Limit Exceeded", if you don't print anything or forget to flush the output, including the final answer.

To flush you can use (just after printing a query and line end):

  * fflush(stdout) in C++; 
  * System.out.flush() in Java; 
  * stdout.flush() in Python; 
  * flush(output) in Pascal; 
  * For other languages see documentation. 



Hacks format

For hacks, use the following format:

In the first line print three integers n, start, x (1 ≤ n ≤ 50000, 1 ≤ start ≤ n, 0 ≤ x ≤ 109).

In the next n lines print the description of the elements of the list: in the i-th line print two integers valuei and nexti (0 ≤ valuei ≤ 109,  - 1 ≤ nexti ≤ n, nexti ≠ 0).

The printed structure should be a valid singly linked list. In particular, it should be possible to reach all elements from start by following links nexti, and the last element end should have -1 in the nextend.

Example

Input

5 3 80
97 -1
58 5
16 2
81 1
79 4


Output

? 1
? 2
? 3
? 4
? 5
! 81

Note

You can read more about singly linked list by the following link: <https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list>

The illustration for the first sample case. Start and finish elements are marked dark. <image>

Solution (in JAVA):

Solution:

import java.util.Scanner;

public class B843 {

	static Scanner s;
	static boolean offline = false;

	public static int[] offlineQuery(int ind) {
		// int[][] ans = { { 62, 4 }, { 23, 1 }, { 12, 5 }, { 88, 7 }, { 19, 2 }, { 203,
		// -1 }, { 102, 6 } };
		// int[][] ans =
		// { {1072, 394}, {532, 1743}, {1620, 822}, {1739, 1022}, {211, 144}, {874,
		// 1461}, {1778, 494}, {699, 605}, {750, 184}, {621, 140}, {573, 1570}, {1689,
		// 552}, {1011, 1198}, {881, 133}, {714, 292}, {1356, 735}, {1845, 1714}, {976,
		// 681}, {401, 83}, {999, 1863}, {630, 1999}, {491, 1444}, {125, 1190}, {403,
		// 862}, {604, 624}, {305, 85}, {1400, 1328}, {302, 1096}, {614, 1840}, {1191,
		// 1722}, {1129, 1883}, {560, 474}, {704, 1210}, {1361, 282}, {52, 1409}, {1788,
		// 834}, {890, 1558}, {1304, 888}, {657, 1058}, {780, 50}, {272, 710}, {1500,
		// 1104}, {1039, 666}, {971, 1344}, {755, 1386}, {1165, 1041}, {1829, 1098},
		// {83, 1784}, {1026, 346}, {781, 1191}, {317, 1478}, {575, 310}, {62, 397},
		// {80, 1921}, {1085, 1941}, {1589, 918}, {1194, 668}, {1277, 1426}, {202,
		// 1993}, {1869, 800}, {1379, 390}, {968, 1101}, {536, 1464}, {1634, 1996},
		// {729, 694}, {1813, 1789}, {1862, 1607}, {172, 1391}, {1755, 1910}, {1177,
		// 1260}, {1334, 1215}, {1582, 629}, {639, 75}, {1627, 1018}, {640, 1809}, {494,
		// 1613}, {661, 906}, {1754, 69}, {1215, 787}, {226, 736}, {783, 208}, {1657,
		// 226}, {402, 24}, {512, 1166}, {306, 155}, {917, 422}, {1918, 1506}, {644,
		// 439}, {36, 1008}, {949, 1894}, {1493, 1032}, {550, 1990}, {151, 1555}, {1071,
		// 1}, {587, 777}, {1417, 1465}, {568, 245}, {33, 1770}, {195, 1619}, {405,
		// 1420}, {1720, 458}, {182, 593}, {382, 1440}, {1557, 1140}, {538, 711}, {1564,
		// 879}, {1524, 1769}, {887, 1969}, {1325, 771}, {1125, 974}, {1933, 333},
		// {1097, 1273}, {348, 194}, {807, 1475}, {697, 646}, {1482, 326}, {93, 726},
		// {514, 851}, {1823, 1185}, {1671, 1909}, {264, 1001}, {1890, 572}, {1879,
		// 598}, {389, 1111}, {886, 108}, {1810, 1081}, {1818, 529}, {1131, 1494}, {397,
		// 557}, {1330, 360}, {1421, 1362}, {31, 713}, {882, 228}, {274, 1787}, {262,
		// 145}, {462, 247}, {1143, 1541}, {723, 498}, {1467, 788}, {622, 1309}, {1881,
		// 1378}, {1748, 283}, {131, 659}, {212, 715}, {263, 121}, {1716, 462}, {1548,
		// 1060}, {805, 622}, {547, 1406}, {1729, 168}, {922, 829}, {129, 1861}, {215,
		// 1177}, {91, 1207}, {307, 221}, {1554, 588}, {1921, 993}, {1262, 502}, {945,
		// 1881}, {522, 1211}, {789, 1308}, {1629, 1612}, {1915, 178}, {1853, 723},
		// {1531, 756}, {1388, 700}, {1507, 183}, {1730, 461}, {625, 1738}, {1044, 667},
		// {1020, 825}, {225, 80}, {1221, 1403}, {1229, 540}, {189, 1938}, {929, 661},
		// {563, 1314}, {1916, 1634}, {1182, 1239}, {297, 1600}, {283, 1385}, {1399,
		// 27}, {1508, 1084}, {751, 1445}, {1084, 55}, {1348, 812}, {1382, 365}, {121,
		// 1529}, {41, 571}, {48, 1490}, {1766, 263}, {1965, 917}, {1106, 1432}, {349,
		// 1208}, {1374, 257}, {1442, 294}, {1386, 830}, {1464, 1818}, {762, 803}, {315,
		// 517}, {868, 745}, {68, 928}, {410, 1877}, {214, 153}, {1860, 895}, {1249,
		// 240}, {1993, 695}, {784, 933}, {313, 420}, {1497, 1976}, {156, 1516}, {399,
		// 472}, {855, 1950}, {1353, 1569}, {544, 497}, {124, 23}, {1476, 859}, {291,
		// 234}, {1794, 739}, {1079, 274}, {308, 403}, {153, 1228}, {1276, 58}, {1432,
		// 1622}, {1526, 1265}, {1658, 1012}, {1067, 1915}, {883, 973}, {60, 609}, {28,
		// 1241}, {1452, 1296}, {760, 971}, {1676, 325}, {292, 1568}, {703, 33}, {1025,
		// 49}, {143, 499}, {1441, 196}, {1393, 1439}, {1250, 277}, {337, 693}, {967,
		// 62}, {288, 1775}, {14, 989}, {569, 658}, {504, 610}, {463, 1745}, {848, 922},
		// {1346, 988}, {16, 1122}, {941, 1145}, {672, 423}, {829, 1528}, {948, 90},
		// {1553, 156}, {1062, 871}, {1375, 1086}, {145, 1493}, {120, 188}, {646, 656},
		// {1176, 70}, {516, 811}, {1767, 313}, {106, 1798}, {497, 411}, {701, 766},
		// {1737, 269}, {603, 25}, {1738, 4}, {1384, 1695}, {1692, 991}, {1622, 1519},
		// {1205, 1135}, {1080, 1684}, {1010, 13}, {1702, 1611}, {1251, 429}, {589,
		// 1395}, {1412, 1831}, {1254, 435}, {572, 11}, {1362, 751}, {1749, 1069},
		// {1742, 1381}, {877, 565}, {432, 1120}, {149, 984}, {311, 1929}, {1287, 1005},
		// {1411, 279}, {335, 1443}, {715, 837}, {1519, 1227}, {1443, 1383}, {558,
		// 1914}, {1103, 577}, {737, 1258}, {258, 1168}, {713, 15}, {961, 366}, {1451,
		// 231}, {1447, 566}, {1430, 434}, {1708, 1983}, {199, 1803}, {620, 10}, {835,
		// 349}, {1522, 1688}, {1989, 1810}, {576, 1130}, {648, 412}, {1256, 1010},
		// {1768, 815}, {1815, 1974}, {1402, 1015}, {1579, 660}, {1227, 391}, {924,
		// 841}, {408, 912}, {1954, 607}, {25, 1149}, {1884, 353}, {1646, 464}, {1909,
		// 1435}, {1677, 990}, {1483, 1418}, {246, 1793}, {440, 1732}, {997, 1709},
		// {128, 152}, {5, 1627}, {879, 1254}, {1934, 1343}, {1936, 1934}, {18, 1355},
		// {876, 285}, {1312, 1785}, {1267, 1028}, {956, 523}, {290, 218}, {1407, 644},
		// {1906, 387}, {1859, 205}, {67, 202}, {692, 1279}, {1027, 1690}, {51, 35},
		// {168, 1827}, {836, 448}, {543, 215}, {1200, 1533}, {1175, 261}, {1885, 1839},
		// {872, 452}, {955, 339}, {1100, 727}, {1777, 7}, {363, 1376}, {1560, 850},
		// {1331, 530}, {170, 1960}, {766, 374}, {1004, 852}, {1173, 1718}, {1383, 270},
		// {962, 1292}, {1673, 437}, {671, 252}, {791, 426}, {1151, 1369}, {518, 1898},
		// {269, 1417}, {943, 712}, {767, 941}, {1797, 970}, {1586, 1182}, {477, 1455},
		// {1463, 198}, {1209, 1704}, {1264, 533}, {1487, 1256}, {339, 1373}, {358,
		// 1316}, {1920, 157}, {1406, 341}, {147, 853}, {1907, 1290}, {322, 747}, {813,
		// 923}, {1380, 521}, {1228, 174}, {966, 242}, {1134, 1202}, {1073, 916}, {1160,
		// 900}, {1889, 122}, {63, 1324}, {1414, 527}, {1684, 721}, {1551, 1912}, {103,
		// 1143}, {825, 1819}, {309, 1896}, {916, 86}, {900, 1944}, {369, 1053}, {1712,
		// 809}, {1877, 1962}, {1018, 1742}, {188, 175}, {498, 1710}, {649, 1196}, {663,
		// 1059}, {467, 1905}, {379, 858}, {1900, 1645}, {1872, 491}, {1158, 1588},
		// {1286, 289}, {314, 200}, {939, 927}, {918, 554}, {673, 757}, {893, 1011},
		// {231, 1040}, {792, 1638}, {482, 590}, {964, 1534}, {1252, 1699}, {1974,
		// 1144}, {344, 920}, {1409, 1284}, {1637, 665}, {1431, 224}, {1255, 312}, {267,
		// 1868}, {1674, 1220}, {1246, 1731}, {645, 260}, {635, 1121}, {1300, 450},
		// {1511, 1982}, {295, 1855}, {47, 190}, {96, 935}, {1979, 1853}, {1664, 915},
		// {837, 1885}, {1168, 1814}, {1301, 793}, {973, 1966}, {873, 6}, {776, 595},
		// {1108, 1235}, {857, 1560}, {443, 534}, {326, 1901}, {1721, 978}, {1971, 706},
		// {1694, 824}, {1731, 1129}, {1717, 670}, {1848, 1323}, {1647, 1902}, {134,
		// 1563}, {1328, 1548}, {252, 1483}, {1060, 601}, {1792, 549}, {1190, 30},
		// {1303, 38}, {400, 19}, {1805, 1967}, {561, 1243}, {1437, 1027}, {304, 26},
		// {507, 1576}, {1172, 364}, {863, 1276}, {21, 1500}, {1760, 865}, {937, 913},
		// {1835, 873}, {1337, 1764}, {1323, 950}, {1359, 1106}, {373, 1377}, {555,
		// 1774}, {638, 73}, {1927, 780}, {1873, 1119}, {520, 897}, {1774, 1361}, {1779,
		// 1933}, {1942, 1047}, {794, 1633}, {545, 1006}, {724, 845}, {144, 258}, {1964,
		// 192}, {1828, 47}, {1263, 380}, {1984, 1052}, {446, 750}, {276, 662}, {1405,
		// 385}, {1736, 267}, {934, 880}, {1275, 223}, {1783, 1078}, {8, 1470}, {1455,
		// 795}, {1518, 293}, {831, 1162}, {1611, 1224}, {455, 634}, {316, 51}, {633,
		// 701}, {208, 1904}, {23, 1067}, {1381, 187}, {1656, 82}, {957, 1544}, {1987,
		// 1109}, {1765, 191}, {460, 1833}, {1415, 1713}, {535, 63}, {1819, 875}, {1332,
		// 770}, {1999, 1866}, {690, 1388}, {1265, 1582}, {444, 1997}, {1245, 438},
		// {1850, 1776}, {287, 243}, {1088, 1655}, {1876, 408}, {1230, 1370}, {711,
		// 1991}, {77, 677}, {1478, 1043}, {294, 443}, {1460, 1782}, {76, 542}, {1591,
		// 854}, {1827, 501}, {1793, 219}, {254, 1922}, {1279, 1873}, {1690, 893}, {904,
		// 1701}, {919, 924}, {436, 968}, {996, 329}, {398, 212}, {1365, 882}, {1392,
		// 239}, {137, 1965}, {123, 216}, {1746, 1165}, {757, 650}, {416, 1299}, {878,
		// 332}, {1448, 1575}, {1950, 823}, {1013, 1963}, {820, 728}, {902, 981}, {42,
		// 1134}, {1891, 786}, {1550, 400}, {260, 1457}, {1752, 1270}, {1633, 64},
		// {1104, 1571}, {906, 1338}, {834, 307}, {1344, 1890}, {1435, 1423}, {75, 546},
		// {1503, 1737}, {1391, 559}, {1505, 1945}, {986, 1626}, {1378, 61}, {1555,
		// 748}, {1866, 1968}, {483, 1573}, {1208, 379}, {355, 773}, {183, 799}, {1959,
		// 1522}, {777, 1193}, {736, 297}, {651, 1394}, {1880, 141}, {362, 358}, {1771,
		// 847}, {1061, 256}, {1578, 316}, {1217, 1091}, {328, 1189}, {700, 266}, {1929,
		// 1402}, {1955, 952}, {681, 1504}, {61, 53}, {505, 1893}, {1838, 1064}, {113,
		// 742}, {733, 1673}, {368, 406}, {818, 1192}, {56, 1598}, {928, 176}, {815,
		// 949}, {984, 1799}, {1758, 683}, {1239, 1200}, {806, 114}, {908, 1509}, {605,
		// 1014}, {1734, 1777}, {1566, 1487}, {1282, 1935}, {1544, 1642}, {1583, 1238},
		// {584, 1176}, {637, 489}, {421, 652}, {1594, 1071}, {456, 1913}, {1539, 1152},
		// {707, 673}, {1320, 1847}, {1341, 801}, {1812, 66}, {241, 1773}, {486, 1666},
		// {927, 617}, {527, 1665}, {1408, 432}, {754, 45}, {698, 8}, {1914, 163}, {430,
		// 759}, {1043, 170}, {758, 1826}, {1852, 164}, {422, 1062}, {683, 1589}, {448,
		// 1169}, {978, 1510}, {647, 311}, {1893, 1949}, {570, 1272}, {132, 1515},
		// {1580, 764}, {930, 1988}, {277, 722}, {46, 444}, {27, 230}, {1638, 1871},
		// {1040, 1003}, {1045, 1848}, {1195, 1630}, {20, 480}, {1718, 1283}, {163,
		// 836}, {249, 1882}, {708, 1280}, {1112, 843}, {1093, 1345}, {774, 779}, {78,
		// 1551}, {1091, 1587}, {331, 697}, {224, 172}, {977, 655}, {1470, 1683}, {1759,
		// 481}, {1864, 724}, {1683, 399}, {471, 1030}, {1171, 478}, {1945, 1535},
		// {1370, 1128}, {1102, 296}, {666, 1795}, {1967, 1092}, {338, 382}, {730,
		// 1694}, {1994, 1126}, {1572, 1545}, {332, 1527}, {320, 1592}, {223, 680},
		// {1389, 1146}, {634, 440}, {1212, 1004}, {1655, 522}, {534, 528}, {245, 327},
		// {1972, 1859}, {160, 1986}, {1926, 490}, {354, 592}, {273, 134}, {539, 1681},
		// {944, 159}, {32, 98}, {159, 707}, {213, 204}, {1593, 633}, {1233, 1285},
		// {912, 961}, {773, 676}, {1822, 119}, {1685, 1605}, {278, 1924}, {1854, 1174},
		// {1865, 589}, {911, 718}, {94, 1289}, {1101, 690}, {821, 729}, {822, 870},
		// {871, 354}, {1715, 146}, {488, 868}, {722, 138}, {1490, 1772}, {1357, 1959},
		// {227, 1473}, {1652, 1365}, {1141, 1469}, {1795, 1269}, {1232, 717}, {653,
		// 1397}, {114, 1856}, {579, 1050}, {629, 21}, {869, 1334}, {1899, 416}, {323,
		// 995}, {1556, 104}, {386, 1484}, {447, 654}, {1363, 1907}, {1604, 1366}, {198,
		// 305}, {1114, 1336}, {1352, 214}, {1532, 1368}, {674, 1320}, {1149, 1396},
		// {431, 286}, {1037, 1151}, {749, 9}, {1705, 1255}, {1607, 1459}, {1581, 72},
		// {1944, 688}, {702, 235}, {953, 1768}, {642, 1581}, {1121, 1891}, {1333, 71},
		// {1326, 856}, {1741, 284}, {356, 1372}, {656, 39}, {679, 1674}, {142, 237},
		// {588, 278}, {1624, 944}, {775, 453}, {1928, 606}, {1662, 1485}, {1315, 1852},
		// {1868, 60}, {764, 802}, {846, 1103}, {1892, 657}, {1216, 603}, {1468, 848},
		// {429, 648}, {786, 1685}, {1434, 581}, {735, 596}, {1302, 471}, {1454, 512},
		// {1456, 1416}, {696, 115}, {469, 1864}, {1571, 696}, {184, 1495}, {1870,
		// 1363}, {1342, 966}, {765, 362}, {763, 784}, {1517, 513}, {1445, 1603}, {465,
		// 1442}, {1285, 419}, {1295, 1733}, {1713, 1923}, {1006, 840}, {517, 371},
		// {1349, 1641}, {618, 1946}, {1614, 987}, {1769, 1979}, {1803, 1964}, {1450,
		// 301}, {74, 582}, {88, 1107}, {810, 1978}, {1242, 1849}, {1621, 272}, {1951,
		// 1186}, {1695, 1183}, {1021, 831}, {1052, 1767}, {1610, 515}, {1260, 1994},
		// {923, 318}, {1387, 166}, {1022, 1164}, {994, 1711}, {1198, 1033}, {1789,
		// 1179}, {1669, 1127}, {164, 1329}, {716, 1080}, {1367, 844}, {581, 1017},
		// {1007, 1779}, {925, 1181}, {210, 5}, {1113, 754}, {1368, 1330}, {725, 885},
		// {187, 410}, {1772, 1313}, {1469, 682}, {1059, 468}, {1561, 1434}, {515, 262},
		// {1005, 810}, {148, 287}, {1592, 716}, {947, 254}, {1327, 466}, {65, 1331},
		// {380, 1947}, {1477, 543}, {990, 1113}, {181, 102}, {404, 100}, {627, 1844},
		// {175, 1083}, {1761, 1450}, {1248, 206}, {451, 1725}, {489, 1951}, {595,
		// 1547}, {823, 1278}, {1063, 1188}, {1065, 1267}, {1836, 998}, {885, 125},
		// {1820, 910}, {219, 891}, {1024, 236}, {1912, 1318}, {1565, 626}, {935, 1698},
		// {1481, 116}, {1366, 838}, {206, 1585}, {1530, 165}, {726, 1178}, {1214, 79},
		// {2, 1948}, {1305, 1002}, {473, 1229}, {1116, 1664}, {220, 1114}, {1204, 273},
		// {1691, 271}, {1763, 1020}, {1861, 67}, {1516, 804}, {521, 160}, {1162, 1358},
		// {1631, 1085}, {1161, 898}, {13, 244}, {1660, 1095}, {271, 41}, {1480, 881},
		// {285, 930}, {662, 413}, {7, 511}, {845, 785}, {1031, 946}, {1821, 720}, {804,
		// 148}, {409, 203}, {938, 421}, {39, 1105}, {1665, 1517}, {1074, 1708}, {1966,
		// 692}, {1590, 547}, {86, 1596}, {345, 1591}, {197, 753}, {849, 1306}, {814,
		// 618}, {920, 1000}, {1219, 1679}, {112, 612}, {940, 251}, {69, 1549}, {1,
		// 887}, {286, 537}, {798, 1623}, {1110, 1503}, {785, 790}, {1124, 110}, {97,
		// 1651}, {1817, 127}, {747, 1813}, {1904, 1977}, {1181, 179}, {553, 1371},
		// {768, 1175}, {670, 368}, {427, 1341}, {1625, 1825}, {299, 1971}, {1032,
		// 1407}, {1644, 1225}, {1054, 1136}, {816, 1322}, {1324, 109}, {601, 1780},
		// {1956, 1806}, {407, 319}, {371, 1586}, {597, 1692}, {418, 1118}, {549, 92},
		// {141, 776}, {1991, 1133}, {1751, 575}, {913, 1870}, {72, 1184}, {1035, 994},
		// {745, 1751}, {105, 264}, {1343, 580}, {1462, 378}, {437, 1550}, {1395, 1356},
		// {1798, 1139}, {761, 199}, {1049, 1823}, {884, 874}, {1126, 1234}, {1123,
		// 934}, {1202, 1657}, {975, 18}, {1722, 1468}, {1563, 106}, {1600, 1497}, {903,
		// 553}, {1223, 1231}, {12, 901}, {150, 93}, {599, 1660}, {90, 154}, {1615,
		// 1441}, {1347, 186}, {15, 250}, {1678, 1817}, {1693, 460}, {1781, 1514},
		// {1922, 1223}, {1036, 760}, {324, 1845}, {1699, 1068}, {280, 1194}, {1837,
		// 611}, {1269, 1540}, {921, 151}, {265, 1557}, {1306, 1251}, {1041, 1676},
		// {1213, 886}, {1288, 1658}, {546, 149}, {960, 300}, {37, 1042}, {233, 1199},
		// {1257, 1415}, {894, 1293}, {1659, 902}, {127, 330}, {606, 1513}, {1403,
		// 1606}, {1598, 1507}, {582, 1352}, {1628, 162}, {827, 1063}, {1764, 525},
		// {1570, 798}, {1740, 772}, {244, 705}, {1688, 12}, {102, 401}, {140, 958},
		// {1438, 1791}, {1268, 999}, {239, 1488}, {472, 889}, {1003, 363}, {1494,
		// 1073}, {1199, 351}, {1711, 407}, {243, 1023}, {1535, 1430}, {375, 1617},
		// {501, 1639}, {1883, 322}, {232, 1009}, {1166, 1621}, {38, 914}, {1479, 904},
		// {1187, 1577}, {800, 1841}, {485, 641}, {1943, 765}, {1426, 1942}, {706, 636},
		// {580, 839}, {420, 632}, {1985, 1880}, {370, 954}, {1925, 708}, {391, 1247},
		// {732, 613}, {1273, 1287}, {658, 1335}, {664, 1088}, {1549, 573}, {1336, 484},
		// {423, 1867}, {828, 253}, {1839, 1216}, {612, 1553}, {898, 1580}, {24, 321},
		// {1700, 1766}, {1750, 960}, {179, 1720}, {1595, 1763}, {952, 767}, {1495,
		// 1531}, {1309, 1511}, {1911, 878}, {1597, 1016}, {1136, 1602}, {1784, 1342},
		// {1009, 275}, {717, 1277}, {1811, 639}, {1157, 418}, {176, 1650}, {1509,
		// 1530}, {1632, 576}, {1376, 1354}, {1180, 939}, {665, 691}, {992, 1760},
		// {1940, 1452}, {1218, 925}, {1968, 1869}, {1051, 826}, {238, 1029}, {1661,
		// 781}, {303, 476}, {839, 1755}, {1830, 1252}, {529, 1754}, {1299, 441}, {969,
		// 1593}, {668, 1554}, {847, 248}, {1501, 1467}, {40, 189}, {1360, 34}, {89,
		// 986}, {1189, 470}, {1988, 309}, {45, 663}, {390, 1055}, {1617, 1987}, {991,
		// 1089}, {221, 1583}, {1977, 1778}, {1145, 1326}, {1499, 42}, {419, 1051},
		// {1874, 1973}, {433, 1931}, {636, 631}, {17, 335}, {71, 962}, {1970, 459},
		// {257, 298}, {1995, 1594}, {1670, 120}, {1371, 1421}, {1732, 1687}, {577,
		// 1274}, {744, 964}, {842, 1624}, {1992, 207}, {43, 1263}, {1206, 1275}, {1055,
		// 1218}, {1186, 1044}, {892, 424}, {1799, 1727}, {1558, 1230}, {797, 931},
		// {694, 1697}, {104, 965}, {1975, 1340}, {942, 373}, {1390, 584}, {959, 1007},
		// {365, 1412}, {26, 664}, {205, 883}, {1038, 43}, {1540, 1932}, {442, 456},
		// {859, 1226}, {229, 1739}, {687, 1380}, {802, 1801}, {1707, 304}, {1514,
		// 1244}, {686, 1156}, {1724, 1930}, {832, 1419}, {1458, 1205}, {1023, 877},
		// {1747, 142}, {513, 118}, {388, 124}, {259, 574}, {449, 1584}, {1728, 150},
		// {1649, 1936}, {1651, 737}, {341, 1300}, {1855, 1325}, {769, 1221}, {585,
		// 1405}, {216, 1319}, {727, 1943}, {1790, 1815}, {1609, 827}, {926, 642},
		// {1587, 1723}, {1696, 1636}, {73, 818}, {1824, 1663}, {1952, 1542}, {812,
		// 389}, {1064, 872}, {329, 1424}, {126, 1013}, {782, 81}, {819, 569}, {778,
		// 1843}, {281, 1209}, {1148, 758}, {650, 597}, {1355, 16}, {1012, 568}, {234,
		// 1315}, {1240, 1454}, {1668, 835}, {1135, 1077}, {525, 1961}, {1030, 909},
		// {1459, 545}, {426, 943}, {92, 117}, {350, 1854}, {282, 181}, {705, 1049},
		// {523, 1876}, {1291, 1804}, {319, 698}, {1961, 1753}, {1335, 1061}, {1840,
		// 1538}, {1179, 1087}, {1056, 1482}, {1424, 1895}, {1675, 233}, {770, 1536},
		// {1537, 1474}, {1923, 1927}, {1612, 1615}, {1645, 323}, {860, 1719}, {1520,
		// 1797}, {154, 1811}, {474, 1572}, {1559, 359}, {1224, 1525}, {1015, 1888},
		// {1834, 483}, {1127, 1446}, {1109, 932}, {117, 1958}, {1983, 503}, {1584,
		// 1734}, {1183, 1706}, {109, 1449}, {29, 1458}, {193, 1604}, {562, 177}, {1515,
		// 896}, {593, 1438}, {1284, 807}, {392, 2000}, {980, 1661}, {624, 169}, {237,
		// 1094}, {1307, 1295}, {1831, 1783}, {1576, 1758}, {880, 14}, {1706, 1158},
		// {1488, 1838}, {116, 1236}, {738, 1920}, {1475, 217}, {1178, 1217}, {453,
		// 1954}, {772, 719}, {44, 1110}, {742, 1462}, {1527, 1489}, {1687, 1024},
		// {1066, 227}, {720, 1631}, {1796, 375}, {1753, 78}, {481, 427}, {571, 281},
		// {1098, 1919}, {578, 743}, {1207, 591}, {864, 1431}, {718, 1291}, {824, 402},
		// {693, 1142}, {709, 1677}, {1164, 46}, {167, 348}, {1719, 101}, {1410, 290},
		// {1234, 1288}, {353, 709}, {1274, 509}, {1235, 1862}, {95, 445}, {1908, 324},
		// {719, 1268}, {963, 428}, {895, 1307}, {1048, 972}, {1308, 1074}, {1453, 794},
		// {1981, 1526}, {1440, 238}, {417, 956}, {342, 1878}, {82, 48}, {951, 1072},
		// {496, 265}, {1314, 782}, {1809, 126}, {850, 1736}, {896, 1667}, {790, 369},
		// {623, 1249}, {1485, 1721}, {866, 1502}, {1857, 1858}, {1773, 493}, {564,
		// 1816}, {235, 1889}, {359, 1970}, {119, 259}, {1913, 647}, {217, 1808}, {675,
		// 1886}, {989, 860}, {817, 615}, {1849, 536}, {64, 857}, {1856, 1312}, {1146,
		// 1614}, {660, 77}, {1401, 315}, {165, 1590}, {1369, 689}, {66, 344}, {1931,
		// 1752}, {1318, 1597}, {870, 730}, {659, 1327}, {1115, 890}, {557, 295}, {907,
		// 623}, {1373, 195}, {1976, 1115}, {428, 789}, {1785, 1537}, {1935, 334}, {972,
		// 451}, {1094, 1860}, {1534, 1036}, {1069, 1561}, {511, 84}, {616, 1499},
		// {1259, 828}, {1473, 1726}, {583, 630}, {1423, 1219}, {1377, 587}, {19, 669},
		// {1396, 1448}, {592, 1245}, {1163, 1281}, {1602, 1812}, {510, 1348}, {1775,
		// 1579}, {1422, 1353}, {1871, 417}, {395, 1411}, {1653, 1616}, {1605, 1653},
		// {567, 97}, {1533, 1346}, {1152, 1466}, {1231, 740}, {554, 488}, {357, 383},
		// {340, 1173}, {425, 1206}, {139, 1026}, {364, 1148}, {374, 1037}, {1882,
		// 1039}, {1887, 1875}, {688, 1926}, {1743, 1691}, {99, 1729}, {1444, 805},
		// {1963, 500}, {284, 905}, {756, 563}, {1472, 1351}, {691, 345}, {1947, 1559},
		// {50, 347}, {173, 1501}, {256, 1125}, {1842, 1635}, {652, 741}, {590, 1989},
		// {1150, 370}, {654, 1491}, {1492, 91}, {35, 89}, {844, 908}, {1237, 1828},
		// {1930, 1332}, {1222, 982}, {1293, 1520}, {586, 95}, {548, 957}, {1033, 1762},
		// {1574, 1521}, {53, 1481}, {378, 415}, {396, 129}, {366, 1413}, {367, 614},
		// {1420, 131}, {1258, 1350}, {1457, 1163}, {270, 903}, {1484, 1310}, {833,
		// 579}, {406, 953}, {1372, 1339}, {1513, 1159}, {1436, 475}, {330, 679}, {566,
		// 1367}, {1278, 551}, {1193, 57}, {854, 213}, {608, 1874}, {1536, 1222}, {865,
		// 1311}, {1107, 454}, {1710, 1034}, {1562, 979}, {1910, 1075}, {1568, 1670},
		// {1903, 938}, {594, 869}, {1394, 969}, {383, 1824}, {1616, 1112}, {466, 414},
		// {336, 241}, {492, 1539}, {752, 1472}, {1128, 31}, {1895, 1749}, {1397, 1601},
		// {110, 1543}, {1762, 894}, {1680, 1916}, {1941, 495}, {1698, 996}, {1241,
		// 821}, {478, 1746}, {1272, 1057}, {261, 135}, {30, 132}, {1608, 1180}, {1211,
		// 702}, {875, 336}, {743, 1131}, {476, 377}, {537, 105}, {1418, 1805}, {1153,
		// 1850}, {1502, 583}, {1723, 1161}, {1142, 137}, {9, 1939}, {1017, 409}, {753,
		// 645}, {228, 1155}, {1538, 635}, {808, 1887}, {611, 1065}, {1429, 303}, {318,
		// 1213}, {361, 599}, {841, 1132}, {54, 1649}, {1057, 1562}, {253, 550}, {387,
		// 1167}, {1663, 447}, {1745, 562}, {1567, 1436}, {240, 640}, {1528, 1820}, {49,
		// 1390}, {655, 774}, {1898, 746}, {146, 386}, {1132, 1715}, {185, 1759}, {1082,
		// 1846}, {1601, 1359}, {1226, 317}, {617, 813}, {22, 520}, {174, 864}, {867,
		// 201}, {1111, 674}, {682, 653}, {1077, 1832}, {1919, 384}, {1599, 980}, {162,
		// 671}, {909, 1524}, {979, 1248}, {1310, 1980}, {251, 467}, {607, 1429}, {1782,
		// 510}, {133, 465}, {157, 1672}, {1666, 1618}, {1757, 620}, {1623, 778}, {1294,
		// 808}, {1575, 1253}, {1960, 1214}, {1939, 1090}, {910, 725}, {1225, 1498},
		// {1982, 1237}, {333, 1842}, {830, 514}, {122, 561}, {1510, 442}, {1496, 210},
		// {1466, 139}, {1201, 976}, {965, 392}, {1946, 1389}, {771, 1262}, {1786,
		// 1628}, {1841, 1393}, {493, 76}, {1270, 1735}, {1144, 1116}, {1953, 320},
		// {111, 926}, {958, 1147}, {1573, 1408}, {1076, 1505}, {596, 955}, {1329, 130},
		// {70, 1123}, {438, 1717}, {79, 54}, {59, 229}, {613, 29}, {669, 942}, {152,
		// 222}, {1801, 1680}, {266, 436}, {891, 1138}, {1948, 1879}, {858, 1154},
		// {1070, 94}, {1058, 849}, {135, 1771}, {1317, 1333}, {1297, 1748}, {889, 37},
		// {932, 1741}, {293, 544}, {1354, 1197}, {574, 52}, {1105, 193}, {475, 1463},
		// {484, 1046}, {677, 1682}, {1449, 817}, {508, 1632}, {1188, 1108}, {1096,
		// 112}, {1776, 357}, {899, 405}, {643, 88}, {1266, 338}, {222, 699}, {450,
		// 867}, {207, 519}, {372, 487}, {1092, 675}, {1159, 395}, {684, 1740}, {166,
		// 1282}, {346, 1644}, {321, 388}, {970, 44}, {1996, 1730}, {101, 1025}, {87,
		// 819}, {1319, 637}, {57, 1821}, {11, 983}, {298, 945}, {1398, 182}, {1137,
		// 1984}, {1446, 302}, {194, 99}, {1686, 1266}, {1404, 506}, {1863, 684}, {796,
		// 1141}, {204, 1150}, {541, 1807}, {1703, 1756}, {1630, 899}, {495, 1303},
		// {1147, 1195}, {1613, 814}, {1654, 703}, {376, 1900}, {1667, 1201}, {196,
		// 921}, {1726, 1712}, {1167, 449}, {1433, 791}, {799, 1045}, {843, 1400},
		// {1118, 1857}, {987, 1918}, {6, 907}, {1787, 36}, {1642, 1956}, {1196, 1668},
		// {721, 733}, {509, 1360}, {795, 1608}, {1917, 87}, {1843, 1802}, {1697, 1453},
		// {1185, 1137}, {793, 496}, {502, 1678}, {1546, 1788}, {1350, 1800}, {1545,
		// 1640}, {85, 919}, {347, 113}, {1901, 1834}, {1636, 433}, {1156, 1082}, {1807,
		// 1908}, {55, 616}, {177, 1671}, {98, 1382}, {632, 518}, {1606, 763}, {385,
		// 749}, {1089, 1925}, {458, 1937}, {1203, 892}, {1289, 1953}, {413, 1981},
		// {600, 951}, {981, 1975}, {352, 1286}, {1825, 1899}, {1117, 1625}, {528,
		// 1099}, {487, 732}, {897, 1066}, {1197, 833}, {1938, 1523}, {1569, 1021},
		// {178, 1070}, {158, 714}, {734, 792}, {680, 608}, {1542, 1728}, {1042, 649},
		// {710, 541}, {503, 246}, {1220, 173}, {1802, 816}, {540, 1610}, {678, 775},
		// {1471, 1387}, {1081, 1496}, {787, 1702}, {108, 1240}, {1733, 625}, {1523,
		// 107}, {531, 2}, {1028, 1765}, {1744, 1486}, {598, 985}, {862, 479}, {731,
		// 1056}, {1385, 197}, {1340, 638}, {695, 796}, {936, 482}, {1253, 280}, {1641,
		// 1629}, {905, 578}, {788, 161}, {741, 1264}, {1210, 1460}, {1428, 1477},
		// {1184, 1637}, {1640, 1700}, {1075, 1546}, {998, 20}, {499, 1917}, {995, 556},
		// {1727, 1170}, {1416, 96}, {1846, 1897}, {1133, 393}, {412, 1659}, {439, 328},
		// {1174, 352}, {861, 1693}, {180, 861}, {1486, 381}, {1192, 1427}, {1588, 56},
		// {1958, 594}, {452, 1261}, {1474, 1259}, {1800, 1556}, {1543, 628}, {100,
		// 1595}, {1997, 1830}, {1247, 866}, {441, 1153}, {1296, 1565}, {1585, 376},
		// {1271, 1456}, {851, 1744}, {1504, 585}, {626, 863}, {230, 425}, {685, 1160},
		// {933, 508}, {1019, 171}, {533, 704}, {852, 1851}, {464, 806}, {479, 1928},
		// {192, 1242}, {1298, 1100}, {1896, 1792}, {1322, 485}, {746, 937}, {1932,
		// 111}, {1962, 1384}, {530, 1689}, {840, 1480}, {1704, 762}, {1139, 1835},
		// {1577, 602}, {186, 846}, {993, 832}, {394, 1364}, {1034, 963}, {1596, 1076},
		// {1338, 1985}, {1029, 1204}, {1701, 276}, {1053, 948}, {954, 355}, {1525,
		// 225}, {34, 1399}, {136, 560}, {1491, 1398}, {242, 1035}, {556, 1337}, {289,
		// 340}, {1851, 651}, {1735, 507}, {1978, 446}, {1008, 1079}, {602, 268}, {1619,
		// 3}, {1461, 967}, {1832, 1972}, {84, 1643}, {1313, 1304}, {1281, 627}, {275,
		// 505}, {1547, 147}, {1814, 314}, {1155, 1647}, {1439, 1298}, {1897, 1492},
		// {247, 1872}, {1002, 1031}, {667, 1102}, {1682, 685}, {1521, 308}, {107,
		// 1686}, {985, 586}, {1351, 755}, {803, 911}, {1844, 17}, {200, 1952}, {1292,
		// 1404}, {1419, 1414}, {1957, 1724}, {542, 350}, {218, 876}, {641, 768}, {1990,
		// 959}, {155, 211}, {1603, 752}, {748, 761}, {1169, 1995}, {1791, 469}, {565,
		// 1425}, {1679, 1451}, {1465, 1532}, {826, 1019}, {1529, 884}, {58, 1552},
		// {191, 1747}, {1050, 1093}, {384, 1654}, {1626, 74}, {759, 232}, {169, 361},
		// {1238, 621}, {4, 331}, {1998, 531}, {1413, 398}, {1078, 220}, {461, 136},
		// {1902, 1437}, {1140, 738}, {301, 28}, {610, 1476}, {1489, 734}, {1886, 1379},
		// {615, 1349}, {801, 1157}, {334, 291}, {779, 40}, {628, 744}, {325, 457},
		// {1083, 185}, {1321, 1750}, {1046, 1957}, {1243, 1906}, {1154, 1790}, {853,
		// 1428}, {1316, 1564}, {1980, 1297}, {351, 1662}, {296, 180}, {115, 1257},
		// {1119, 1884}, {1858, 343}, {1973, 430}, {1095, 1578}, {130, 143}, {1236,
		// 1401}, {1000, 1911}, {470, 686}, {983, 619}, {2000, -1}, {424, 1374}, {268,
		// 372}, {1969, 1124}, {914, 1892}, {1639, 1707}, {248, 672}, {1280, 1786},
		// {609, 1837}, {1888, 396}, {524, 1203}, {411, 1716}, {343, 431}, {1949, 567},
		// {1986, 524}, {946, 855}, {250, 1512}, {1130, 128}, {1120, 769}, {838, 1097},
		// {676, 1574}, {809, 820}, {1016, 1471}, {236, 1250}, {1345, 249}, {1122, 975},
		// {915, 404}, {506, 477}, {950, 1302}, {1425, 1048}, {310, 288}, {1847, 463},
		// {519, 492}, {1826, 548}, {377, 1410}, {327, 604}, {1648, 1171}, {1087, 538},
		// {209, 842}, {468, 797}, {1244, 535}, {1364, 558}, {1808, 1305}, {1672, 367},
		// {1756, 1518}, {1001, 1794}, {1552, 255}, {457, 1656}, {559, 32}, {1068,
		// 1347}, {1681, 1796}, {500, 1038}, {988, 1321}, {1099, 356}, {739, 1955}, {81,
		// 1301}, {255, 1392}, {1714, 731}, {279, 997}, {1090, 678}, {689, 532}, {1924,
		// 1054}, {480, 1271}, {312, 209}, {1725, 1620}, {434, 1998}, {1541, 1675},
		// {1780, 992}, {1937, 1669}, {1283, 1246}, {1650, 1172}, {459, 526}, {190,
		// 1822}, {10, 1599}, {552, 940}, {1086, 1903}, {1427, 1705}, {728, 65}, {901,
		// 570}, {1506, 167}, {619, 306}, {381, 103}, {3, 1829}, {1894, 1447}, {856,
		// 455}, {490, 22}, {201, 59}, {1290, 1212}, {454, 516}, {740, 1703}, {1643,
		// 947}, {1047, 1294}, {118, 1317}, {1358, 486}, {171, 68}, {526, 643}, {1878,
		// 123}, {1014, 1232}, {1804, 473}, {138, 1375}, {974, 977}, {1806, 1648},
		// {1867, 783}, {888, 1566}, {360, 1479}, {300, 1836}, {1833, 1233}, {1875,
		// 539}, {1816, 936}, {982, 1865}, {1498, 1117}, {1905, 342}, {811, 1187},
		// {1770, 600}, {1311, 337}, {414, 1992}, {1512, 1422}, {1709, 1433}, {1138,
		// 1757}, {1339, 1696}, {161, 1508}, {1618, 1781}, {931, 1567}, {591, 1357},
		// {551, 1940}, {712, 299}, {415, 564}, {203, 1609}, {1261, 158}, {1170, 687},
		// {1635, 1646}, {445, 504}, {435, 555}, {631, 1652}, {393, 1761} };
		int[][] ans = { { 60, -1 }, { 30, 4 }, { 20, 2 }, { 40, 5 }, { 50, 1 } };
		return ans[ind - 1];
	}

	public static int[] query(int ind) {
		System.out.println("? " + ind);
		System.out.flush();
		if (!offline) {
			int val = s.nextInt(), next = s.nextInt();
			if (val == -1 && next == -1) {
				System.exit(0);
			}
			return new int[] { val, next };
		} else {
			return offlineQuery(ind);
		}
	}

	public static void finish(int ans) {
		System.out.println("! " + ans);
		System.out.flush();
		s.close();
	}

	public static void main(String[] args) {

		s = new Scanner(System.in);

		int N, start, X;
		if (!offline) {
			N = s.nextInt();
			start = s.nextInt();
			X = s.nextInt();
		} else {
			N = 5;
			start = 3;
			X = 75;
		}
		int guesses = 1;
		int[] query = query(start);
		if (query[0] >= X) {
			finish(query[0]);
			return;
		}
		int bestVal = query[0], bestInd = query[1];

		while (guesses < 1000) {
			int att = (int) (Math.random() * N) + 1;
			// while (guessed.contains(att))
			// att = (int) (Math.random() * N) + 1;
			query = query(att);
			// guessed.add(att);
			guesses++;
			if (query[0] == X) {
				finish(query[0]);
				return;
			}
			if (query[0] > X)
				continue;
			if (query[0] > bestVal) {
				bestVal = query[0];
				bestInd = query[1];
			}
		}

		// String end = String.format("%d, next guess will be %d", bestVal, bestInd);

		while (bestInd != -1 && guesses < 1999) {
			query = query(bestInd);
			if (query[0] >= X) {
				finish(query[0]);
				return;
			}
			bestInd = query[1];
		}

		if (bestInd == -1) {
			finish(-1);
		} else {
			finish(bestVal);
		}
		s.close();

	}

}