#include <bits/stdc++.h>
using namespace std;
int lim = 1 << 19;
long long mod = 1000000007;
const int N = 1000005;
const double G = 9.8;
int n, m;
double V, a[N];
map<double, double> walls;
pair<int, double> orig_order[N];
pair<double, double> ans[N];
double get_y(double alpha, double x) {
  double t = x / V / cos(alpha);
  return V * sin(alpha) * t - G * t * t / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(6);
  cout << fixed;
  cin >> n >> V;
  for (int i = 0; i < n; i++) {
    orig_order[i].first = i;
    cin >> orig_order[i].second;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    double x, y;
    cin >> x >> y;
    walls[x] = max(walls[x], y);
  }
  sort(orig_order, orig_order + n,
       [](pair<int, double>& a, pair<int, double>& b) {
         return a.second < b.second;
       });
  for (int i = 0; i < n; i++) {
    ans[orig_order[i].first].first = V * V * sin(2 * orig_order[i].second) / G;
    ans[orig_order[i].first].second = 0.0;
  }
  int cur = 0;
  for (auto x : walls) {
    while (cur != n && get_y(orig_order[cur].second, x.first) <= x.second) {
      if (get_y(orig_order[cur].second, x.first) >= 0) {
        ans[orig_order[cur].first].first = x.first;
        ans[orig_order[cur].first].second =
            get_y(orig_order[cur].second, x.first);
      }
      cur++;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i].first << ' ' << ans[i].second << endl;
  }
  return 0;
}
