#include <bits/stdc++.h>
using namespace std;
namespace chtholly {
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar()) f ^= c == '-';
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return f ? x : -x;
}
template <typename mitsuha>
inline bool read(mitsuha &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c) && ~c; c = getchar()) f ^= c == '-';
  if (!~c) return 0;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return x = f ? x : -x, 1;
}
template <typename mitsuha>
inline int write(mitsuha x) {
  if (!x) return 0 & putchar(48);
  if (x < 0) x = -x, putchar('-');
  int bit[20], i, p = 0;
  for (; x; x /= 10) bit[++p] = x % 10;
  for (i = p; i; --i) putchar(bit[i] + 48);
  return 0;
}
inline char fuhao() {
  char c = getchar();
  for (; isspace(c); c = getchar())
    ;
  return c;
}
}  // namespace chtholly
using namespace chtholly;
const int yuzu = 1e5;
const double g = 9.8;
namespace gongshi {
double vxt(double v, double alp) { return v * cos(alp); }
double vyt(double v, double alp, double t) { return v * sin(alp) - g * t; }
double xt(double v, double alp, double t) { return v * cos(alp) * t; }
double yt(double v, double alp, double t) {
  return v * sin(alp) * t - g * t * t / 2;
}
double _tx(double x, double alp, double v) { return x / v / cos(alp); }
double _ty(double v, double alp) { return 2 * v * sin(alp) / g; }
}  // namespace gongshi
using namespace gongshi;
struct qiang {
  double x, y;
  void rd() { scanf("%lf%lf", &x, &y); }
  bool operator<(const qiang &b) const { return x != b.x ? x < b.x : y < b.y; }
} w[yuzu | 10];
pair<double, int> a[yuzu | 10];
pair<double, double> llx[yuzu | 10];
int main() {
  int i, n = read();
  double alp, v = read();
  for (i = 1; i <= n; ++i) {
    scanf("%lf", &alp);
    a[i] = pair<double, int>(alp, i);
  }
  sort(a + 1, a + n + 1);
  int m = read(), r = 1;
  for (i = 1; i <= m; ++i) w[i].rd();
  sort(w + 1, w + m + 1);
  for (i = 1; i <= n; ++i) {
    for (; r <= m && yt(v, a[i].first, _tx(w[r].x, a[i].first, v)) > w[r].y;
         ++r)
      ;
    llx[a[i].second] =
        yt(v, a[i].first, _tx(w[r].x, a[i].first, v)) <= 0 || r > m
            ? make_pair(xt(v, a[i].first, _ty(v, a[i].first)), 0.)
            : make_pair(w[r].x, yt(v, a[i].first, _tx(w[r].x, a[i].first, v)));
  }
  for (i = 1; i <= n; ++i) printf("%.9lf %.9lf\n", llx[i].first, llx[i].second);
  return 0;
}
