#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
struct circle
{
int x, r;
double y;
};
vector<circle> circles;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
{
int x, r;
cin >> x >> r;
double y = r + .0;
for (const auto &c : circles)
{
if (c.r + r > abs(c.x - x))
{
double dy = sqrt(pow(c.r + r, 2) - pow(c.x - x, 2) + .0);
y = max(y, c.y + dy);
}
}
circles.push_back(circle{x, r, y});
printf("%.7f %.7f\n", x + .0, y);
}
return 0;
}