\begin{tikzpicture}[paper figure,x=1mm,y=1mm] \path[use as bounding box] (0,0) rectangle (134,45.00); \draw (10.0,6.0) rectangle (54.0,40.0); \path[train box] (15.69,12.64) rectangle (16.89,34.04); \path[train box] (26.16,12.64) rectangle (27.36,34.04); \path[train box] (36.64,12.64) rectangle (37.84,34.04); \path[train box] (47.11,18.08) rectangle (48.31,34.04); \path[bar box] (17.49,34.64) rectangle (25.56,35.84); \path[bar box] (38.44,34.64) rectangle (46.51,35.84); \path[bar box] (17.49,10.84) rectangle (25.56,12.04); \path[short box] (27.96,10.84) rectangle (28.86,12.04); \path[bar box] (30.16,10.84) rectangle (36.04,12.04); \node[figure label] at (26.76,8.40) {OR}; \path[bar box] (48.91,16.28) rectangle (54.00,17.48); \draw[guide] (13.79,33.04) -- (50.21,33.04); \node[port] at (16.29,35.24) {}; \node[port] at (16.29,11.44) {}; \node[figure label] at (16.29,42.40) {$\mathsf{a}$}; \node[port] at (26.76,35.24) {}; \node[port] at (26.76,11.44) {}; \node[figure label] at (26.76,42.40) {$\mathsf{b}$}; \node[port] at (37.24,35.24) {}; \node[port] at (37.24,11.44) {}; \node[figure label] at (37.24,42.40) {$\mathsf{c}$}; \node[port] at (47.71,35.24) {}; \node[port] at (47.71,16.88) {}; \node[figure label] at (47.71,42.40) {$\mathsf{d}$}; \draw[guide] (10.0,23.00) -- (54.0,23.00); \draw (66.0,6.0) rectangle (126.0,40.0); \path[train box] (71.21,18.08) rectangle (72.41,28.60); \path[train box] (80.88,18.08) rectangle (82.08,34.04); \path[train box] (90.56,12.64) rectangle (91.76,34.04); \path[train box] (100.24,12.64) rectangle (101.44,28.60); \path[train box] (109.92,12.64) rectangle (111.12,34.04); \path[train box] (119.59,18.08) rectangle (120.79,34.04); \path[bar box] (82.68,34.64) rectangle (89.96,35.84); \path[bar box] (73.01,29.20) rectangle (99.64,30.40); \path[bar box] (111.72,34.64) rectangle (118.99,35.84); \path[bar box] (73.01,16.28) rectangle (80.28,17.48); \path[bar box] (92.36,10.84) rectangle (99.64,12.04); \path[short box] (102.04,10.84) rectangle (102.94,12.04); \path[bar box] (104.24,10.84) rectangle (109.32,12.04); \node[figure label] at (100.84,8.40) {OR}; \path[bar box] (121.39,16.28) rectangle (126.00,17.48); \draw[guide] (78.98,33.04) -- (122.69,33.04); \draw[guide] (69.31,27.60) -- (103.34,27.60); \node[port] at (71.81,29.80) {}; \node[port] at (71.81,16.88) {}; \node[figure label] at (71.81,42.40) {$\mathsf{p}$}; \node[port] at (81.48,35.24) {}; \node[port] at (81.48,16.88) {}; \node[figure label] at (81.48,42.40) {$\mathsf{q}$}; \node[port] at (91.16,35.24) {}; \node[port] at (91.16,11.44) {}; \node[figure label] at (91.16,42.40) {$\mathsf{a}$}; \node[port] at (100.84,29.80) {}; \node[port] at (100.84,11.44) {}; \node[figure label] at (100.84,42.40) {$\mathsf{b}$}; \node[port] at (110.52,35.24) {}; \node[port] at (110.52,11.44) {}; \node[figure label] at (110.52,42.40) {$\mathsf{c}$}; \node[port] at (120.19,35.24) {}; \node[port] at (120.19,16.88) {}; \node[figure label] at (120.19,42.40) {$\mathsf{d}$}; \draw[guide] (66.0,23.00) -- (126.0,23.00); \node[figure label] at (32.00,1.5) {(a)}; \node[figure label] at (96.00,1.5) {(b)}; \end{tikzpicture}%