**Chef and An Ideal Problem Codechef Solution:** â€śAn ideal problem has no test data.â€ť â€“ aryanc403

**This is an interactive problem.**

Chef likes probability puzzles a lot, almost as much as interactive problems. Today, he learned about theÂ Monty Hall Paradox.

Suppose that Chef is participating in a game show, where he has to choose between three doors numberedÂ 11Â throughÂ 33. There is a car behind one of the doors and goats behind the other two. Chef does not know what is behind which door, but there is a game host who knows where the car is.

First, you need to help Chef pick a door (letâ€™s denote it byÂ XX). Then, the host opens a different door (letâ€™s denote it byÂ YY) such that there is a goat behind this door, and asks Chef to pick an arbitrary door again (letâ€™s denote it byÂ ZZ). You need to help Chef pick doorÂ ZZÂ too. You should do it in such a way that the probability of a car being behind doorÂ ZZÂ is maximised. If there are multiple optimal possible ways to pick doors for Chef, you may choose any one.

### Interaction

- First, you should print a line containing a single integerÂ XXÂ (1â‰¤Xâ‰¤31â‰¤Xâ‰¤3).
- Then, you should read a line containing a single integerÂ YY.
- Finally, you should print a line containing a single integerÂ ZZÂ (1â‰¤Zâ‰¤31â‰¤Zâ‰¤3).

Donâ€™t forget to flush the output after printing each line!

### Constraints

- 1â‰¤Yâ‰¤31â‰¤Yâ‰¤3
- Xâ‰ YXâ‰ Y

### Example

You Grader 3 1 2

## Chef and An Ideal ProblemÂ â€“ CodeChef Solution in JAVA

import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner input = new Scanner(System.in); System.out.println(1); int x = input.nextInt(); System.out.println((x == 2 ? 3 : 2)); } }

## Chef and An Ideal Problem- CodeChef Solution in CPP

#include<iostream> using namespace std; int main(){ int x = 1, y , z; cout << x << endl; cin >> y; cout << 6 - x - y << endl; return 0; }

## Chef and An Ideal Problem -CodeChef Solution in Python

print('1') n=int(input()) if n==2: print('3') else: print('2')

** Disclaimer:Â The above Problem (Chef and An Ideal Problem) is generated by**Â CodeChef but the solution is provided byÂ Â

**Chase2learn**.This tutorial is only forÂ

**Educational**Â andÂ

**Learning**Â purpose.