#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_
