\begin{tikzpicture}[scale=1,transform shape]
\ctikzset{
    logic ports=ieee,
    logic ports/scale=1
 }

\node[nand port] at (1.75,0.56)(not1){N2};
\node[nand port] at (1.75,4*0.56)(not2){N1};

\node[nand port] at (4.5,0.56)(nanda){N4};
\node[nand port] at (4.5,4*0.56)(nandb){N3};
\node[nand port] at (6.75,2.5*0.56)(n2){N5};

\draw (nanda.out) |- (n2.in 2);
\draw (nandb.out) |- (n2.in 1);

\node (a) at (0,0.56) {$b$};
\node (b) at (0,2.2384) {$a$};
%\node (out1) at (2.,2) {};
\node (y) at (8.25,2.5*0.56) {$out$};

\coordinate (A) at (0.65,0.841-0.2814);
\fill (A) circle (1.5pt);

\draw[name path = a1] (A) |- (not1.in 1); 
\draw[name path = a2] (A) |- (not1.in 2);
\draw (A) --++ (-.45,0);



\coordinate (B) at (0.65,2.2384);
\fill (B) circle (1.5pt);

\draw (B) |- (not2.in 1);
\draw (B) |- (not2.in 2);
\draw (B) --++ (-.45,0);

\draw (not1.out) |- (nanda.in 2);
\draw (not2.out) |- (nandb.in 1);

\draw[name path = b1](B) --++ (-7pt,0) --++ (0,-20pt) --++ (75pt,0)|- (nanda.in 1);
\draw[name path = a1](A) --++ (-7pt,0) --++ (0,20pt) --++ (70pt,0)|- (nandb.in 2);

\path[name intersections={of=a1 and b1, by=e}];
\fill[color=white] (e) circle[radius=0.16\crossing];% erase plain crossing
\draw (e) node[jump crossing]{};

%\draw(n2.output) -- (y);

\end{tikzpicture}