Angry Professor

0

0 votes
Easy
Problem

Professor OMP is angry with the students! So he decided to subject the students to conditional attendance. He came to the class and randomly picked 2 students with roll numbers ‘i’ and ‘j’ and declared that the first person to sign the attendance sheet has a roll number among the roll nos falling between ‘i’ and ‘j’ (including both of them). Further to add to the misery of students, he wants that the attendance sheet should be circulated among the students only in a particular pattern.

Suppose if roll number ‘n’ gets the attendance sheet, he will pass on the sheet to roll no ‘3n+1’ if n is odd or he will give the sheet to roll no ‘n/2’ if n is even until it reaches to roll no 1.

Now the student body wants to maximize the number of students who get attendance.Every student who signs the sheet will get attendance. Help them by picking out the roll number of the student who should be the first to sign the attendance sheet.

Input:

The input will consist of a series of pairs of integers i and j, one pair of integers per line. All integers will be less than 10,000 and greater than 0.

Output:

For each pair of input integers i and j you should output i j and the maximum number of students who get attendance on a new line.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?