#P6803. 「ICPC World Finals 2020」胜利者,我们的向量是什么?

「ICPC World Finals 2020」胜利者,我们的向量是什么?

Description

Vector embeddings are a common tool in machine learning systems. Complex real-world concepts (for instance, words in a dictionary) are mapped onto vectors of real numbers. If embeddings are trained properly, related concepts remain close together in the vector space, so questions like "are these two words synonyms?" can be reduced to straightforward mathematical tests.

You have been hired by Ye Olde Ice Cream Shoppe to create an embedding model for flavors, so that when they are out of an ice cream flavor they can recommend related flavors to customers. After training your embedding on six cloud datacenters for four months, you finally had the perfect flavor model! You were ready to revolutionize the ice cream industry on your street and, dare we say it, your neighborhood! Well, until you accidentally dripped some free ice cream on your keyboard and deleted half the data. The Shoppe cannot afford the 30 billion rubles needed to retrain the model, so you are in trouble.

Fortunately, you still have various training results lying around. For a given deleted vector, the training data tells you how close it was to some known flavor vectors. The closeness of vectors AA and BB is just the standard Euclidean distance metric (that is, the length of the vector ABA - B). Write a tool that reconstructs embeddings which are consistent with the training results.

Input

The first line contains two integers dd and nn, where dd (1d5001 \leq d \leq 500) is the number of dimensions of the vectors, and nn (1n5001 \leq n \leq 500) is the number of training results for a deleted embedding vector you want to reconstruct. Each of the next nn lines describes a training result using d+1d + 1 numbers x1,,xdx_1, \dots, x_d and ee. In a training result, x1,,xdx_1, \dots, x_d (100xi100-100 \leq x_i \leq 100) are the coordinates of a known vector, and ee (0e50000 \leq e \leq 5\,000) is the Euclidean distance from that vector to the deleted one.

Your submission will be tested only with the sample inputs given below and inputs generated according to the following procedure. First, dd and nn are chosen. Then, nn input vectors and 11 output vector, each with dimension dd, are chosen at random. The d(n+1)d \cdot (n + 1) coordinates are independent and uniformly distributed in the interval [100,100][-100,100]. Next, the Euclidean distance from each input vector to the output vector is computed. Finally, the output vector is discarded. Calculations use double-precision floating-point numbers. Numbers obtained using this procedure appear in the input with 1717 digits after the decimal point.

Output

Output dd values, the coordinates of any vector that has the given distance to each training vector with an absolute or relative error of at most 10510^{-5}.

2 3
0 0 2.5
3 0 2.5
1.5 0.5 2.5

1.5 -2

2 2
0 0 2
4 -4 6

1.414213562373 1.414213562373

4 3
0 1 2 3 2
1 2 -1 7 5
1 0.3 3.4 1.2 3.3

1 2 3 4