#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10, M = 1e5 + 10;
const long double G = 9.8;
int n, V, m;
struct wall {
  long double x, y;
} ar[M];
struct ball {
  long double shib, ansx, ansy;
  int indx;
  ball() {
    indx = 0;
    shib = ansx = ansy = 0.0;
  }
} bll[N];
long double get(long double x, long double alpha) {
  long double t = (long double)x / ((long double)V * cos((long double)alpha));
  return (long double)V * sin((long double)alpha) * t -
         ((long double)G * t * t) / 2.0;
}
void solve(int indx) {
  long double t = (long double)(2.0 * V * sin((long double)bll[indx].shib)) /
                  (long double)G;
  bll[indx].ansx = (long double)V * cos(bll[indx].shib) * t;
}
int main() {
  cin >> n >> V;
  for (int i = 0; i < n; i++) {
    cin >> bll[i].shib;
    bll[i].indx = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) cin >> ar[i].x >> ar[i].y;
  sort(bll, bll + n, [&](ball a, ball b) { return a.shib < b.shib; });
  sort(ar, ar + m, [&](wall a, wall b) { return a.x < b.x; });
  int l = 0, r = 0;
  while (l < n) {
    long double alpha = bll[l].shib;
    while (r < m && get(ar[r].x, alpha) >= ar[r].y) r++;
    if (r == m)
      bll[l].ansy = 0;
    else
      bll[l].ansy = max((long double)0.0, get(ar[r].x, alpha));
    if (bll[l].ansy == 0.0)
      solve(l);
    else
      bll[l].ansx = ar[r].x;
    l++;
  }
  sort(bll, bll + n, [&](ball a, ball b) { return a.indx < b.indx; });
  for (int i = 0; i < n; i++)
    cout << fixed << setprecision(10) << bll[i].ansx << ' ' << bll[i].ansy
         << '\n';
  cout << endl;
}
