N-বহুভূজ (N-gon Checker)

CPU: 0.5s
Memory: 1024MB


ইউক্লিডীয় জ্যামিতিতে, সুষম উত্তল বহুভুজ হচ্ছে এমন একটি বহুভুজ যার সকল অভ্যন্তর কোণের পরিমাপ সমান, সমবাহু (সকল বাহুর দৈর্ঘ্যের পরিমাপ সমান) এবং সকল অভ্যন্তর কোণের পরিমাপ 180 ডিগ্রি এর চেয়ে কম।একটি N-gon কে সংজ্ঞায়িত করি একটি সুষম উত্তল বহুভুজ হিসেবে, যার Nটি বাহু এবং Nটি অভ্যন্তর কোণ রয়েছে, যেখানে N একটি ধনাত্মক পূর্ণসংখ্যা।

একটি অঋণাত্মক পূর্ণসংখ্যা X দেওয়া হলে, তোমাকে বলতে হবে এমন একটি বৈধ N-gon গঠন করা সম্ভব কিনা যার সকল অভ্যন্তর কোণের মানের যোগফল X এর সমান হয়। যদি সম্ভব হয়, তাহলে Nএর মান এবং N-gon টির অভ্যন্তর কোণের মানও বের করতে হবে।

In Euclidean geometry, a regular convex polygon is a polygon that is equiangular (all interior angles are equal in measure), equilateral (all sides have the same length) and all interior angles are less than 180 degrees. Let's define an N-gon as a regular convex polygon which has N sides and N interior angles, where N is a positive integer.

Given a non-negative integer X, your task is to find whether a valid N-gon can be formed whose summation of all the interior angles is equal to X. If it's possible, then also find the value of N and the interior angle of the N-gon.


ইনপুটের বর্ণনা

ইনপুটের প্রথম লাইনে একটি ধনাত্মক পূর্ণসংখ্যা T দেওয়া থাকবে, যা নির্ধারণ করবে টেস্টকেসের সংখ্যা। পরের T টি লাইনে একটিমাত্র অঋণাত্মকপূর্ণ সংখ্যা X থাকবে।


Input Specification

The first line of input contains a positive integer T which denotes the number of test cases. The next T lines will contain a single non-negative integer X.


আউটপুটের বর্ণনা

প্রতি টেস্ট কেস i এর জন্য, একটিমাত্র লাইন আউটপুট করতে হবে, যা শুরু হবে কেস নাম্বার দিয়ে প্রদত্ত ফরম্যাটে “Case i: ”, উদ্ধৃতি চিহ্ন ছাড়া।

এরপর যদি একটি বৈধ N-gon গঠন করা সম্ভব হয়, তাহলে শূণ্যস্থান দ্বারা পৃথক করে দুটি পূর্ণসংখ্যা N এবং A আউটপুট করতে হবে প্রদত্ত ফরম্যাটে “N A” উদ্ধৃতি চিহ্ন ছাড়া যা যথাক্রমে নির্ধারণ করে N এর মান, যা প্রব্লেম স্টেটমেন্টে সংজ্ঞায়িত করা হয়েছিল এবং N-gon টির অভ্যন্তর কোণের মান। অন্যথায় আউটপুট করতে হবে “Impossible” উদ্ধৃতি চিহ্ন ছাড়া। A এর মান তার নিকটতম পূর্ণসংখ্যাতে রাউন্ড করতে হবে।

স্পষ্ট বিবরণের জন্য নমুনা ইনপুট/আউটপুট দেখ।

সীমাবদ্ধতা:

ছোট সাবটাস্ক: T <= 100, 0 <= X <= 10^5, ৩০ পয়েন্টের জন্য

বড় সাবটাস্ক: T <= 10^5, 0 <= X <= 10^18, ৭০ পয়েন্টের জন্য


Output Specification

For each test casei, output a single line starting with the case number in the format “Case i: ” without the quotes.

Then if it is possible to form a valid N-gon, output two space separated integers N and Ain the format “N A” without quotes,which are the values of N as mentioned in the problem description and the value of the interior angle of the N-gon respectively. Otherwise output “Impossible” instead without the quotes.The value of A should be rounded to its nearest integer.

See the sample input/output for more details.

Constraints:

Small Subtask: T <= 100, 0 <= X <= 10^5, for 30 points

Large Subtask: T <= 10^5, 0 <= X <= 10^18, for 70 points


Sample

InputOutput
3 120 180 360Case 1: Impossible Case 2: 3 60 Case 3: 4 90

ব্যাখ্যা: প্রথম ক্ষেত্রে, এমন কোন বৈধ N-gon নেই যার সকল অভ্যন্তর কোণের পরিমাপের সমষ্টি 120 এর সমান।

Explanation: For the first case, there is no valid N-gon whose summation of all interior angles is equal to 120.

Large input file. Use scanf/printf.