#include <bits/stdc++.h>
const int N = 10100;
const int M = 100100;
const double G = 9.8;
using namespace std;
struct wall {
  double x, height;
  wall() {}
};
struct shot {
  double angle;
  int id;
  shot() {}
};
struct point {
  double x, y;
  point() {}
  point(double _x, double _y) : x(_x), y(_y) {}
};
point ans[N];
shot shots[N];
wall walls[M];
int main() {
  int n, speed;
  scanf("%d %d", &n, &speed);
  for (int i = 0; i < n; i++) {
    scanf("%lfd", &shots[i].angle);
    shots[i].id = i;
  }
  sort(shots, shots + n,
       [](const shot &a, const shot &b) { return a.angle < b.angle; });
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%lf %lf", &walls[i].x, &walls[i].height);
  }
  sort(walls, walls + m,
       [](const wall &a, const wall &b) { return a.x < b.x; });
  int aWall = 0;
  for (int i = 0; i < n; i++) {
    int id = shots[i].id;
    double angle = shots[i].angle;
    bool hit = false;
    double vX = speed * cos(angle), vY = speed * sin(angle);
    while (aWall < m) {
      double t = walls[aWall].x / vX;
      double height = vY * t - G * t * t / 2;
      if (height < 0) {
        break;
      } else if (height > walls[aWall].height) {
        aWall++;
      } else {
        hit = true;
        ans[id].x = walls[aWall].x;
        ans[id].y = height;
        break;
      }
    }
    if (!hit) {
      ans[id].x = (vX * vY * 2) / G;
      ans[id].y = 0.0;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%.10lf %.10lf\n", ans[i].x, ans[i].y);
  }
  return 0;
}
