Traveling Politician

A politician from the Alliance of Conservative Monarchists (ACM) is campaigning for the next election. In order to guarantee his victory, he has to make at least k public speeches. He will give one speech every day. If he has to give several speeches in the same city, they cannot be on consecutive days because that would be unproductive. However, the politician believes that giving speech in one day’s interval is not useless; for example, giving one speech on Monday and the next one in the same city on Wednesday is alright because after two days, the people will forget about his first speech and his second speech will have as much effect as the first one. He is absolutely certain that he will win, so at the same time he is moving to the capital. This means that his first speech will be given in his hometown, and his last speech – in the capital city. He knows that his speech-giving abilities deteriorate when he is tired. So he does not want to give more speeches than he has to; k speeches will be enough to win. What is the minimum number of speeches he has to give in order to start in his hometown, end up in the capital and give at least k speeches (Including his speeches in his hometown and in the capital) on the way, without ever giving a speech in the same city on two consecutive days? Input The input will consist of several test cases. Each test case will begin with 3 integers on a line - n (the number of cities on the map), m (the number of roads connecting cities) and k (the minimum number of speeches). The next m lines will each contain 2 integers, u and v, meaning that the politician can visit city v immediately after visiting city u. All other routes of travel are infeasible from the point of view of his budget. The politician’s hometown is city number 0, and the capital is city number n − 1. You can assume that 2 ≤ n ≤ 50 and 2 ≤ k ≤ 16. Input is terminated by a line containing three zeroes. Output Print one line per test case, giving the minimum total number of speeches. If this is impossible to do, print ‘LOSER’. See examples. If in a scenario the politician requires to give more than 20 speeches he should be considered a LOSER and so in that case you should print ‘LOSER’ as well. Sample Input 333 01 02 12 565 01 03 12 24 32 34 3 3 10 01 10

2/2 12 000 Sample Output 3 LOSER 11