Knots

\usepackage{pstricks, pst-node}
\psset{arrows=->, labelsep=3pt, mnode=circle}
\begin{document}
  \begin{psmatrix}[rowsep=20pt, colsep=28pt]
    A                      & B \\
    $\sqrt{\frac{x+y}{z}}$ & D
    \psset{linestyle=dotted}
    \ncline{1, 1}{1, 2}\naput{\emph{firstly}}
    \ncline{1, 2}{2, 2}\naput{\emph{next}}
    \ncline{2, 2}{2, 1}\naput{\emph{then}}
    \ncline{2, 1}{1, 1}\naput{\emph{last}}
    \nccurve[ncurv=2, 
      linestyle=solid, angleA=90]{1, 1}{2, 2}      
  \end{psmatrix}  
\end{document}