Given the following two properties of the multiplication table, show that $G$ is a group. I came across the following problem:

Note the $1$ below is defined to be the unit element. That is, $1\cdot g=g\cdot 1=g$ for all $g\in G$.
Let $G$ be a finite set with a binary composition and unit. Show that $G$ is a group if and only if the multiplication table has the following properties:
  
  
*
  
*every row and every column contains every element in $G$;
  
*for every pair of elements $x\neq 1,y\neq 1$ of $G$, let $R$ be any rectangle in the body of the table having 1 as one of its vertices, $x$ as a vertex in the same row as 1, $y$ a vertex in the same column as 1, then the fourth vertex of the rectangle depends only on the pair $(x,y)$ and not on the position of 1.

My thoughts so far:
I think the forward direction is relatively easy to show. If $G$ is a group, then any equation of the form $ax=b$ or $ya=b$ has a solution in $G$, which is equivalently the first property. For the second property, suppose we pick a 1 in the multiplication table which is given by $xy$, then $yx$ is also 1. Suppose we then pick an arbitrary $a$ in the row containing the 1, and pick $b$ in the column containing the 1. Then there exist $\tilde{a}$ and $\tilde{b}$ in $G$ such that $x\tilde{a}=a$ and $\tilde{b}y=b$. Hence $ba=(\tilde{b}y)(x\tilde{a})=\tilde{b}(yx)\tilde{a}=\tilde{b}\tilde{a}$. But $\tilde{b}\tilde{a}$ is the fourth element, thus it indeed depends only on $a$ and $b$, proving property 2.
However, I have been stuck on the other direction for quite a while now. I think in this case, property 1 still implies that every equation of the form $ax=b$ and $ya=b$ has a solution, for if we consider the $a$-row, since it contains every element in $G$, it contains $b$, and hence there is another element $x$ such that $ax=b$. Similar for the other equation. Therefore, if I can show $G$ is a semigroup, then it follows that $G$ is a group. This is where the problem is. I think I should show the operation is associative, but I have no idea how to do it. I have been playing around with the idea I used above to show the forward direction, but it does not seem to apply here because neither associativity nor existence of inverse has been established. How should I proceed?
Thanks for reading, any help is greatly appreciated!
 A: FranzNietzsche gave a very nice hint in the comment above, but I was too slow to immediately grasp the idea. Also, I found a neat sketch of proof on this webpage. Since no one has answered, I shall just answer myself.
As I described in the original question, property 1 implies every equation of the form $ax=b$ or $ya=b$ has a solution (note that property 1 indeed implies every element in $G$ has a left inverse and a right inverse, but they are not necessarily the same). Then it suffices to show $G$ is a semigroup. Property 1 ensures the operation is defined and well-defined, hence it is left to show associativity.
First consider a rectangle in the multiplication table whose one vertex is $1$ given by $(1,1)$. Choose $x$ in the row, and $y$ in the column. Then the fourth vertex is naturally $yx$.
$$\begin{array}{c|c c}
&1&x\\
\hline
1&1&x\\
y&y&yx\\
\end{array}$$
Now if we pick any other rectangle in the multiplication table, with $1$ as one vertex (not necessarily given by $(1,1)$), $x$ as the other horizontal vertex, and $y$ as the other vertical vertex, then property 2 implies the fourth vertex has to be $yx$, since no matter where it is, this rectangle should be the same as the one noted above, in view of property 2.
$$\begin{array}{c|c c c c c}
&1&&&&\\
\hline
1&&&&&\\
\\
&&&1&x&\\
&&&y&z&\\
&
\end{array}$$
If $z=1$, then trivially we have $(xy)z=xy=x(yz)$. Hence let's suppose $z\neq 1$. Consider the following table:
$$\begin{array}{c|c c c c c}
&1&&y&&\\
\hline
1&1&&y&&v\\
\\
a&&&1&&z\\
\\
x&x&&xy&&w
\end{array}$$
In this case, we assumed $xy\neq 1$, so $ay=1$ for some $a\neq x$. In the rectangle $y-1-z-v$ (top right), we must have $v=yz$ by the previous observation. In the rectangle $1-xy-w-z$ (bottom right), we similarly have $w=(xy)z$. But in the rectangle $1-x-w-v$ (peripheral), we have $w=xv=x(yz)$. Hence $(xy)z=x(yz)$ in this case.
The case where $xy=1$ is easier. Consider:
$$\begin{array}{c|c c c c c}
&1&&y&&\\
\hline
1&1&&y&&v\\
\\
x&x&&1&&z\\
\\
\end{array}$$
Then in the rectangle $y-1-z-v$ (right), we have $v=yz$. Then in the rectangle $1-x-z-v$ (peripheral), we have $z=xv=x(yz)$. But since $xy=1$, we have $z=1\cdot z=(xy)z$. Hence we again have $(xy)z=x(yz)$.
Associativity is proven. Thus $G$ is a semigroup, and it follows that $G$ is a group.
