#include <bits/stdc++.h>
using namespace std;
int mod(int i, int p) { return (i + p) % p; }
const int MAXN = 1e5 + 5;
const double g = 9.8;
pair<double, double> wall[MAXN];
pair<double, double> ld[MAXN];
bool used[MAXN];
double hy[MAXN];
double hx[MAXN];
double rx[MAXN];
double V;
pair<double, int> alpha[MAXN];
int n;
int m;
bool lessCmp(pair<double, double>& a, pair<double, double>& b) {
  return a.first < b.first;
}
bool pdiCmp(pair<double, int>& a, pair<double, int>& b) {
  return a.first < b.first;
}
int main() {
  cin >> n >> V;
  for (int i = 0; i < n; i++) {
    cin >> alpha[i].first;
    double alp = alpha[i].first;
    alpha[i].second = i;
    double ht = V * sin(alp) / g;
    hx[i] = V * cos(alp) * ht;
    hy[i] = V * sin(alp) * ht - g * ht * ht / 2.0;
    ld[i].first = 2 * hx[i];
    ld[i].second = 0;
  }
  sort(alpha, alpha + n, pdiCmp);
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> wall[i].first >> wall[i].second;
  }
  sort(wall, wall + m, lessCmp);
  int curAlpha = 0;
  int i = 0;
  for (; i < m; i++) {
    pair<double, double> w = wall[i];
    while (curAlpha < n) {
      int idx = alpha[curAlpha].second;
      if (2 * hx[idx] <= w.first) {
        curAlpha++;
        continue;
      }
      double alp = alpha[curAlpha].first;
      double wx = w.first;
      double vx = V * cos(alp);
      double t = wx / vx;
      double curY = V * sin(alp) * t - g * t * t / 2.0;
      if (0 <= w.second - curY && 0 < curY) {
        ld[idx].first = w.first;
        ld[idx].second = curY;
        curAlpha++;
      } else {
        break;
      }
    }
    if (n <= curAlpha) {
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%.6f %.6f\n", ld[i].first, ld[i].second);
  }
  return 0;
}
