import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int i =0;
while (i<n){
int judge = sc.nextInt();
if (judge==1){
double r = sc.nextDouble();
Circle circle = new Circle(r);
String a1 = String.format("%.2f", circle.getArea());
String a2 = String.format("%.2f", circle.getPerimeter());
System.out.println(a1+" "+a2);
}
else if (judge==2){
double length = sc.nextDouble();
double width = sc.nextDouble();
Rectangle rectangle = new Rectangle(length, width);
String c1 = String.format("%.2f",rectangle.getArea());
String c2 = String.format("%.2f", rectangle.getPerimeter());
System.out.println(c1+" "+c2);
}
i++;
}
}
}
class Circle implements Shape{
private double radius;
public Circle(double radius) {
this.radius = radius;
}
@Override
public float getArea() {
float area= (float) (Math.PI*Math.pow(radius,2));
return area;
}
@Override
public float getPerimeter() {
float perimeter = (float) (2*Math.PI*radius);
return perimeter;
}
}
interface Shape{
float getArea();//求面积
float getPerimeter();//求周长
}
class Rectangle implements Shape{
private double length;
private double width;
public Rectangle(double length, double width) {
this.length = length;
this.width = width;
}
@Override
public float getArea() {
float area= (float) (length*width);
return area;
}
@Override
public float getPerimeter() {
float perimeter= (float) ((length+width)*2);
return perimeter;
}
}