#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define rng(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); --i)
#define per(i, b) gnr(i, 0, b)
#define all(obj) begin(obj), end(obj)
#define allr(obj) rbegin(obj), rend(obj)
#define cinv(a) rep(i, (int)a.size()) cin >> a[i]
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<Pi> vp;
typedef vector<vp> vvp;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;

template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int di[] = {0, -1, 0, 1};
const int dj[] = {1, 0, -1, 0};
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e15;
const long double eps = 1e-10;
const char nl = '\n';

ll power(ll a, ll b) { return b ? power(a * a % MOD, b / 2) * (b % 2 ? a : 1) % MOD : 1; }

ll C(int n, int k)
{
	ll x = 1, y = 1;
	for (int i = 1; i <= k; ++i)
	{
		x = x * (n - i + 1) % MOD;
		y = y * i % MOD;
	}
	return x * power(y, MOD - 2) % MOD;
}

struct UF
{
	vi d;
	UF(int n) : d(n, -1) {}
	int root(int x)
	{
		if (d[x] < 0)
			return x;
		return d[x] = root(d[x]);
	}
	bool unite(int x, int y)
	{
		x = root(x);
		y = root(y);
		if (x == y)
			return false;
		if (d[x] > d[y])
			swap(x, y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int size(int x) { return -d[root(x)]; }
};

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	double x0, y0, xn, yn; cin >> x0 >> y0 >> xn >> yn;
	complex<double> a{x0, y0}, b{xn, yn};
	auto o = (a+b)/2.0;
	double angle = 2*M_PI/n;
	complex<double> c{cos(angle), sin(angle)};
	auto ans = o + (a-o)*c;
	cout << ans.real() << " " << ans.imag() << nl;
}

#include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>

using namespace std;

struct Node
{
    int id;
    long long int c;
    long long int diff;
    int depth;
    vector<Node *> next;
};

void travel(Node *curr, long long int currentDiff, Node *from = nullptr)
{
    currentDiff += curr->diff;
    curr->c = currentDiff;

    for(auto &n : curr->next)
    {
        if(n != from)
            travel(n, currentDiff, curr);
    }
}

void setDepth(Node *curr, Node *from = nullptr)
{
    if(from == nullptr)
        curr->depth = 0;
    else
        curr->depth = from->depth + 1;

    for(auto &n : curr->next)
    {
        if(n != from)
            setDepth(n, curr);
    }
}

int main()
{
    int N, Q;
    cin >> N;
    
    auto nodes = vector<Node>(N);
    auto edges = vector<pair<int,int>>(N-1);

    int id = 1;
    for(auto& n : nodes)
    {
        n.id = id++;
        n.next = vector<Node *>();
        n.diff = 0;
        n.c = 0;
    }

    for(auto& e : edges)
    {
        int a, b;
        cin >> a >> b;

        a--;
        b--;

        e.first = a;
        e.second = b;
        nodes[a].next.push_back(&nodes[b]);
        nodes[b].next.push_back(&nodes[a]);
    }

    // set depth, nodes[0] is root
    Node *root = &nodes[0];
    setDepth(root);

    cin >> Q;

    for(int i = 0; i < Q; i++)
    {
        int t, e, x;
        int start, goal;
        cin >> t >> e >> x;

        e--;
        Node *a = &(nodes[edges[e].first]);
        Node *b = &(nodes[edges[e].second]);

        if(t == 2)
            swap(a, b);

        if( a->depth >= b->depth )
        {
            a->diff += x;
        }
        else
        {
            root->diff += x;
            b->diff -= x;
        }
    }

    long long int currentDiff = 0;
    travel(root, currentDiff);

    for(auto n : nodes)
    {
        cout << n.c << endl;
    }
    return 0;
}
