In my judgment, this problem was not quite interpreted correctly by the OP, and by the member who provided the answer. This seems to me to be mainly an "oscillating manometer" problem. The fluid in tank A oscillates up and down, out of phase with the fluid in tank B, which also oscillates up and down. Fluid flows periodically back and forth between tanks A and B through the connecting channel.
In this thread so far, the analyses of this problem seemed to focus on the pressures at locations A and B at the very entrance to the interconnecting tube. What these analyses failed to take into account was that, within tank A, the flow approaching the exit hole is converging (i.e., accelerating) and, as a consequence, the pressure within tank A in the region immediately adjacent to the exit hole is decreasing. This pressure decrease provides the net force for the accelerating flow. So the pressure at the exit hole is lower than throughout most of the base of the tank. Similarly, in tank B, the flow out the entrance hole to tank B diverges and decelerates, so the pressure in the tank beyond the entrance hole is higher than at the hole. All these changes in pressure within the two tanks occur within just a few tube diameters of the holes, so they are very localized. Moreover, in this situation, because the entry flow to the tube is converging and the exit flow from the tube is diverging, the two pressure changes virtually cancel each other out.
Now, here is my analysis of this problem as an oscillating manometer, which I believe was the original intent of the problem:
Let $h_A(t)$ represent the depth of fluid in tank A at time t
Let $h_B(t)$ represent the depth of fluid in tank B at time t
Let $A_A$ represent the cross sectional area of tank A
Let $A_B$ represent the cross sectional area of tank B
Let $\rho$ represent the density of the fluid
In this analysis, we are going to neglect the kinetic energy of the fluid in the connecting channel (compared to that in the tanks).
Using the base of the tanks as the datum for potential energy, the total potential energy of the fluid in both tanks at any time t is:
$$PE=\rho g A_A\frac{h_A^2}{2}+ \rho g A_B\frac{h_B^2}{2}$$
The total kinetic energy of the fluid in both tanks at any time t is:
$$KE=\frac{\rho A_Ah_A}{2}\left(\frac{dh_A}{dt}\right)^2+\frac{\rho A_Bh_B}{2}\left(\frac{dh_B}{dt}\right)^2$$So the total potential energy plus kinetic energy of the fluid in both tanks at any time t is given by:
$$PE+KE=\rho g A_A\frac{h_A^2}{2}+ \rho g A_B\frac{h_B^2}{2}+\frac{\rho A_Ah_A}{2}\left(\frac{dh_A}{dt}\right)^2+\frac{\rho A_Bh_B}{2}\left(\frac{dh_B}{dt}\right)^2\tag{1}$$
Conservation of mass requires that the total mass of liquid does not change with time. this requires that:
$$h_AA_A+h_BA_B=\bar{h}(A_A+A_B)\tag{2}$$
where $\bar{h}$ is the height that the liquid in the two tanks would have at equilibrium.
Since the fluid is assumed inviscid, the sum of the kinetic energy and potential energy of the fluid must be constant. Therefore, the time derivative of the sum of the kinetic energy and potential energy must be zero. If we make use of this condition in conjunction with Eqn. 2, we obtain, after considerable mathematical manipulation, the equation for the time variation of liquid depth in tank A as:
$$gH_A+\bar{h}\frac{d^2H_A}{dt^2}+\left[\frac{(A_B-A_A)}{A_B}\right]\left[\frac{1}{2}\left(\frac{dH_A}{dt}\right)^2+H_A\frac{d^2H_A}{dt^2}\right]=0\tag{3}$$where $H_A=h_A-\bar{h}$. One will not that the first two terms on the left hand side of this equation are linear in $H_A$, but the term in brackets is quadratic. Therefore, if we restrict ourselves to the case of only small initial values of $H_A$, the non-linear terms become negligible, and only the linear terms are important. The solution to this equation for the linearized situation is:$$H_A=H_{A0}\cos{\left(\sqrt{\frac{g}{\bar{h}}}t\right)}\tag{4}$$where $H_{A0}$ is the initial value of $H_A$.
These general results are consistent with with the analyses of oscillating manometers (with certain specific tank area ratios) presented in the following reference: [PDF]Manometer Oscillations - Christopher E. Brennen