#include<bits/stdc++.h> using ll = longlong; using ld = longdouble; using pts = std::complex<ll>; constexprint N = 2005;
structnode { ll up, div; int u, v; }; auto comp = [](node a, node b) { ll L = a.up * b.div, R = b.up * a.div; if (L != R) return L > R; if (a.u != b.u) return a.u > b.u; elsereturn a.v > b.v; };
ll sum = 0; int d = 0; for (int i = 0; i < ws.size(); i++) { sum += ws[i]; if (sum > w) sum -= ws[d++], ans++; } sum += a[u]; ans += sum / w; rest[u] = sum % w; }; dfs(dfs, 1);
template <int MOD = 998244353> class Modulo { private: staticintPow(int a, int b) { int res = 1; while (b) { if (b & 1) { res = (1ll * res * a) % MOD; } b >>= 1, a = (1ll * a * a) % MOD; } return res; } staticintInv(int x){ returnPow(x, MOD - 2); }
#include<bits/stdc++.h> using ld = longdouble; using point = std::complex<ld>; using vi = std::vector<int>;
constexprint N = 1005; const ld pi = std::acos((ld)-1.0);
int n, width[N]; point p[N]; vi G[N];
intmain(){ std::cin >> n; for (int i = 1, u, v; i < n; i++) { std::cin >> u >> v; G[u].push_back(v), G[v].push_back(u); }
auto pre = [&](auto F, int u, int f) -> void { width[u] = 1; for (auto v : G[u]) { if (v == f) continue; F(F, v, u); width[u] += width[v]; } }; pre(pre, 1, 0);
auto dfs = [&](auto F, int u, int f, ld l, ld r) -> void { ld slice = (r - l) / (width[u] - 1), al = l; for (auto v : G[u]) { if (v == f) continue; ld t = al + slice * width[v]; p[v] = p[u] + std::polar(1.0L, (t + al) / 2); F(F, v, u, al, t); al = t; } }; p[1] = {0, 0}; dfs(dfs, 1, 0, 0, pi * 2);
for (int i = 1; i <= n; i++) std::cout << std::setprecision(20) << std::fixed << p[i].real() << " " << p[i].imag() << "\n"; }
voiddraw(){ if (pile.empty()) return; hand.push_back(pile.front()); pile.pop_front(); }
boolbackward(int r, int val){ if (r < 2) return val == row[r].back() - 10; elsereturn val == row[r].back() + 10; }
booloperate(){ bool placed = false; std::vector<std::pair<int, int>> cand; for (int i = 0; i < hand.size(); i++) { for (int r = 0; r < 4; r++) { if (backward(r, hand[i])) { cand.push_back({i, r}); placed = true; break; }
if (cand.size() != 0) break; } if (cand.size() != 0) break; } for (auto [id, r] : cand) { // std::cerr << hand[id] << " is backwarded.\n"; row[r].push_back(hand[id]); hand.erase(hand.begin() + id); }
if (cand.size() != 0) returntrue;
std::vector<std::tuple<int, int, int>> f; for (int i = 0; i < hand.size(); i++) for (int r = 0; r < 4; r++) { if (r < 2) { if (hand[i] > row[r].back()) f.push_back({std::abs(hand[i] - row[r].back()), i, r}), placed = true; } else { if (hand[i] < row[r].back()) f.push_back({std::abs(hand[i] - row[r].back()), i, r}), placed = true; } }
if (f.empty()) returnfalse; std::sort(f.begin(), f.end());
auto [_, i, r] = *f.begin(); row[r].push_back(hand[i]); hand.erase(hand.begin() + i); returntrue; }
intmain(){ for (int i = 1, a; i <= 98; i++) std::cin >> a, pile.push_back(a); row[0].push_back(1), row[1].push_back(1); row[2].push_back(100), row[3].push_back(100);
while (true) { while (hand.size() < 8) draw(); if (hand.empty() || pile.empty()) break;
bool res = operate(); // if (!res) break; res &= operate(); if (!res) break; }
int p = hand.size(); while (true) { if (!operate()) break; // if (hand.size() == p) break; }
for (int r = 0; r < 4; r++) { for (auto i : row[r]) std::cout << i << " "; std::cout << "\n"; } for (auto i : hand) std::cout << i << " "; std::cout << "\n"; for (auto i : pile) std::cout << i << " "; std::cout << "\n"; }