#include <iostream>
#include <cmath>
using namespace std;

double f1(double x,double y){
	return log(x*y);
}
double f2(double x,double y){
    return abs(x)+cos(x*y);
}
int main() {
	double x,y;
	int n;
	cin>>n;
	for (int i=0;i<n;i++){
	cout<<"\n--"<<i<<"--\n";
	cout<<"meaning of x"<<endl;
	cin>>x;
	cout<<"meaning of y"<<endl;
	cin>>y;
	if(x*y>0){
		cout<<"meaning of f1:"<<f1(x,y)<<"\n";
	}
	else { cout<<"undefined";
	}
	int smth=f2(x,y);
	cout<<"meaning of f2:"<<smth<<"\n";
	if(smth*y>0){
		int smth1=f1(smth,y);
		cout<<"new meaning:"<<smth1<<"\n";
	}
	else { cout<<"undefined";
	}
	}
	return 0;
}