#ifndef STRUCT08_H_
#define STRUCT08_H_
#include <iostream>
#include <string>
#include <cassert>
using namespace std;
struct complex_number {
double real;
double imaginary;
};
istream& operator>>(istream& is, complex_number& cpx){
is >> cpx.real >> cpx.imaginary;
return is;
}
ostream& operator<<(ostream& os, complex_number& cpx){
os << cpx.real << " " << cpx.imaginary << endl;
return os;
}
class Judge{
public:
void check_init(){
if(init == 0){
cout << "Please call the init function first!" << endl;
exit(0);
}
}
void check_query(){
if(query == 0){
cout << "Please call Get_Query before answering!" << endl;
exit(0);
}
query = 0;
}
void init_f(int &Q){
cin >> Q;
init = 1;
}
void query_f(int &N, complex_number*& cpx){
cin >> N;
if(first_time) cpx = (complex_number*)malloc(sizeof(complex_number)*1000);
for(int i = 0; i < N; i++)
cin >> cpx[i];
query = 1;
first_time = 0;
}
void answer_f(int N, complex_number* cpx){
cout << N << endl;
for(int i = 0; i < N; i++)
cout << cpx[i];
}
private:
int init = 0;
int query = 0;
int first_time = 1;
};
Judge j;
void Init(int &Q){
j.init_f(Q);
}
void Get_Query(int &N,complex_number*& cpx){
j.query_f(N, cpx);
}
void Answer(int N,complex_number* cpx){
j.answer_f(N, cpx);
}
#endif // STRUCT08_H_
I2lmbmRlZiBTVFJVQ1QwOF9IXwojZGVmaW5lIFNUUlVDVDA4X0hfCgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxjYXNzZXJ0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IGNvbXBsZXhfbnVtYmVyIHsKICAgIGRvdWJsZSByZWFsOwogICAgZG91YmxlIGltYWdpbmFyeTsKfTsKCmlzdHJlYW0mIG9wZXJhdG9yPj4oaXN0cmVhbSYgaXMsIGNvbXBsZXhfbnVtYmVyJiBjcHgpewogICAgaXMgPj4gY3B4LnJlYWwgPj4gY3B4LmltYWdpbmFyeTsKICAgIHJldHVybiBpczsKfQoKb3N0cmVhbSYgb3BlcmF0b3I8PChvc3RyZWFtJiBvcywgY29tcGxleF9udW1iZXImIGNweCl7CiAgICBvcyA8PCBjcHgucmVhbCA8PCAiICIgPDwgY3B4LmltYWdpbmFyeSA8PCBlbmRsOwogICAgcmV0dXJuIG9zOwp9CgpjbGFzcyBKdWRnZXsKICAgIHB1YmxpYzoKICAgICAgICB2b2lkIGNoZWNrX2luaXQoKXsKICAgICAgICAgICAgaWYoaW5pdCA9PSAwKXsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIlBsZWFzZSBjYWxsIHRoZSBpbml0IGZ1bmN0aW9uIGZpcnN0ISIgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGV4aXQoMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdm9pZCBjaGVja19xdWVyeSgpewogICAgICAgICAgICBpZihxdWVyeSA9PSAwKXsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIlBsZWFzZSBjYWxsIEdldF9RdWVyeSBiZWZvcmUgYW5zd2VyaW5nISIgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGV4aXQoMCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcXVlcnkgPSAwOwogICAgICAgIH0KICAgICAgICB2b2lkIGluaXRfZihpbnQgJlEpewogICAgICAgICAgICBjaW4gPj4gUTsKICAgICAgICAgICAgaW5pdCA9IDE7CiAgICAgICAgfQogICAgICAgIHZvaWQgcXVlcnlfZihpbnQgJk4sIGNvbXBsZXhfbnVtYmVyKiYgY3B4KXsKICAgICAgICAgICAgY2luID4+IE47CiAgICAgICAgICAgIGlmKGZpcnN0X3RpbWUpIGNweCA9IChjb21wbGV4X251bWJlciopbWFsbG9jKHNpemVvZihjb21wbGV4X251bWJlcikqMTAwMCk7CiAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBOOyBpKyspCiAgICAgICAgICAgICAgICBjaW4gPj4gY3B4W2ldOwogICAgICAgICAgICBxdWVyeSA9IDE7CiAgICAgICAgICAgIGZpcnN0X3RpbWUgPSAwOwogICAgICAgIH0KICAgICAgICB2b2lkIGFuc3dlcl9mKGludCBOLCBjb21wbGV4X251bWJlciogY3B4KXsKICAgICAgICAgICAgY291dCA8PCBOIDw8IGVuZGw7CiAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBOOyBpKyspCiAgICAgICAgICAgICAgICBjb3V0IDw8IGNweFtpXTsKICAgICAgICB9CiAgICBwcml2YXRlOgogICAgICAgIGludCBpbml0ID0gMDsKICAgICAgICBpbnQgcXVlcnkgPSAwOwogICAgICAgIGludCBmaXJzdF90aW1lID0gMTsKfTsKCkp1ZGdlIGo7Cgp2b2lkIEluaXQoaW50ICZRKXsKICAgIGouaW5pdF9mKFEpOwp9Cgp2b2lkIEdldF9RdWVyeShpbnQgJk4sY29tcGxleF9udW1iZXIqJiBjcHgpewogICAgai5xdWVyeV9mKE4sIGNweCk7Cn0KCnZvaWQgQW5zd2VyKGludCBOLGNvbXBsZXhfbnVtYmVyKiBjcHgpewogICAgai5hbnN3ZXJfZihOLCBjcHgpOwp9CgojZW5kaWYgLy8gU1RSVUNUMDhfSF8K