#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
const int maxn=100010;
struct N{
double x, y;
};
N a[maxn];
int n;
int main()
{
freopen("asm_command.in","r",stdin);
freopen("asm_command.out","w",stdout);
cin>>n;
for (int i=1;i<=n;i++)
a[i].x=0,a[i].y=i;
int q;
cin>>q;
for (int i=1;i<=q;i++)
{
int x;
cin>>x;
if (!x)
{
int y;
cin>>y;
printf("%.1lf %.1lf\n",a[y].x,a[y].y);
}
else if (x==1)
{
int ai,bi,dx,dy;
cin>>ai>>bi>>dx>>dy;
for (int j=ai;j<=bi;j++)
a[j].x+=dx,a[j].y+=dy;
}
else
{
int y,z,deg;
cin>>y>>z>>deg;
if (deg==90)
{
for (int j=y;j<=z;j++)
{
int t=a[j].x;
a[j].x=-a[j].y;
a[j].y=t;
}
}
else if (deg==180)
{
for (int j=y;j<=z;j++)
{
a[j].x=-a[j].x;
a[j].y=-a[j].y;
}
}
else if (deg==270)
{
for (int j=y;j<=z;j++)
{
int t=a[j].y;
a[j].y=-a[j].x;
a[j].x=t;
}
}
}
}
return 0;
}