#include <bits/stdc++.h>
using namespace std;
const double g = 9.8;
const int N = 100010;
const double eps = 1e-8;
const double inf = 1e30;
int n, m, V;
pair<double, int> v[N];
pair<double, double> wall[N], ans[N];
void init() {
  scanf("%d %d", &n, &V);
  for (int i = 0; i < n; ++i) scanf("%lf", &v[i].first), v[i].second = i;
  sort(v, v + n);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) scanf("%lf %lf", &wall[i].first, &wall[i].second);
  wall[m++] = make_pair(inf, inf);
  sort(wall, wall + m);
}
void solve() {
  for (int i = 0, j = 0; i < n; ++i) {
    double t = wall[j].first / cos(v[i].first) / V;
    double y = V * sin(v[i].first) * t - 0.5 * g * t * t;
    if (y < -eps) {
      ans[v[i].second] =
          make_pair(2 * V * V * sin(v[i].first) * cos(v[i].first) / g, 0);
      continue;
    }
    if (y - wall[j].second > eps) {
      j++;
      i--;
      continue;
    }
    ans[v[i].second] = make_pair(wall[j].first, y);
  }
  for (int i = 0; i < n; ++i)
    printf("%.9f %.9f\n", ans[i].first, ans[i].second);
}
int main() {
  init();
  solve();
  return 0;
}
