#include <termios.h>
#include <stdio.h>

int main()
{
  printf("\e[?1000h\e[?1006h");

  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~(ECHO | ICANON);
  tcsetattr(0, TCSANOW, &term);

  int x,y;
  scanf("\e[<0;%d;%dM", &x, &y);

  printf("\e[?1000l");

  printf("%d %d\n", x, y);

  term.c_lflag |= ECHO | ICANON;
  tcsetattr(0, TCSANOW, &term);
}