% (C) Thiago Brevidelli
\begin{tikzpicture}[scale=1.25]
  % the torus holes
  \foreach \x/\i in {0/1, 1.5/2, 4/g} {
    % the curve b_i
    \draw[red, thick]                 (\x,0)+(-90:.35) arc[x radius=.6, y radius=.35, start angle=-90, end angle=270];
    \draw[red, thick, -{>[scale=.5]}] (\x,0)+(-90:.35) arc[x radius=.6, y radius=.35, start angle=-90, end angle=270];
    \draw[red, thick]                 (\x,0)+(-90:.35) node[below] {$b_{\i}$};
    % the curve a_i
    \draw[blue, thick, line cap=round]         (\x,0)+(0,1)          arc[x radius=.1, y radius=.485, start angle=90,  end angle=-90];
    \draw[blue, thick, -{>[scale=.5]}]         (\x,0)+(0,{1-2*.485}) arc[x radius=.1, y radius=.485, start angle=-90, end angle=0];
    \draw[blue, thick, line cap=round, dotted] (\x,0)+(0,1)          arc[x radius=.1, y radius=.485, start angle=90,  end angle=270];
    \draw[blue]                                (\x,0)+(.1,{1-.485})  node[right] {$a_{\i}$};
    % the torus hole
    \begin{scope}[shift={(\x,0)}]
      \draw[thick, line cap=round]
        (210:.4)+(0,.25)
        arc[x radius=.4, y radius=.3, start angle=210, end angle=330];
      \draw[thick] (135:.3)+(0,-.27) arc (135:45:.3);
    \end{scope}
  }
  \foreach \i in {0,1,2} { \filldraw (2.5, 0)+({\i*.25}, 0) circle(0.5pt); }
  % the outer torus
  \draw[thick] (-.5,1) -- (4.5, 1) arc (90:-90:1) -- (-.5,-1) arc (-90:-270:1);
\end{tikzpicture}
