\documentclass{article}
\usepackage{a4wide}
\usepackage{adjustbox}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{ifthen}
\usetikzlibrary{automata}
\usepackage{datetime}
\lhead{./certificates/ctxta1-ctxta2/sim-4162.tex}
\rhead{09:11:48.201 on 2025-04-03}
\fancyfoot{}
\begin{document}
\newif\ifntiny
%\ntinyfalse
\ntinytrue
\thispagestyle{fancy}
\begin{center}
\maxsizebox{!}{0.475\textheight}{
\minsizebox{\textwidth}{!}{
\begin{tabular}{@{}c@{}}
% node count = 22
\begin{tikzpicture}[rotate = 0]
%\begin{tikzpicture}[rotate = 90]
\tikzset{initial text=$ $}

\node[state] at (10,-2) (n1) {$\cup$\,\ifntiny{\tiny 5336}\fi};
\node[state] at (8,-4) (n1n0) {$p?$\,\ifntiny{\tiny 5335}\fi};
\node[accepting, state] at (11,-10) (n1n1n0n1n0) {$p?$\,\ifntiny{\tiny 5321}\fi};
\node[accepting, state] at (4,-12) (n0n0n1n1n0n1) {$p?$\,\ifntiny{\tiny 5218}\fi};
\node[state] at (2,-4) (n0n0) {$p?$\,\ifntiny{\tiny 5332}\fi};
\node[accepting, state] at (6,-4) (n0n1) {$p?$\,\ifntiny{\tiny 5295}\fi};
\node[accepting, state] at (4,-14) (n0n0n1n1n0n1n0) {$p?$\,\ifntiny{\tiny 5217}\fi};
\node[state] at (4,-2) (n0) {$\cup$\,\ifntiny{\tiny 5333}\fi};
\node[accepting, state] at (10,-6) (n1n1n0) {$p!$\,\ifntiny{\tiny 5323}\fi};
\node[accepting, state] at (3,-10) (n0n0n1n1n0) {$p!$\,\ifntiny{\tiny 5219}\fi};
\node[accepting, state] at (10,-12) (n1n1n0n1n0n0) {$p!$\,\ifntiny{\tiny 5318}\fi};
\node[accepting, state] at (3,-16) (n0n0n1n1n0n1n0n0) {$p!$\,\ifntiny{\tiny 5214}\fi};
\node[state] at (1,-8) (n0n0n1n0) {$p?$\,\ifntiny{\tiny 5330}\fi};
\node[accepting, state] at (3,-8) (n0n0n1n1) {$p?$\,\ifntiny{\tiny 5220}\fi};
\node[accepting, state] at (5,-6) (n0n1n0) {$p!$\,\ifntiny{\tiny 5276}\fi};
\node[accepting, state] at (7,-6) (n0n1n1) {$p!$\,\ifntiny{\tiny 5294}\fi};
\node[accepting, state] at (11,-8) (n1n1n0n1) {$p?$\,\ifntiny{\tiny 5322}\fi};
\node[initial, state] at (6,0) (n) {$p?$\,\ifntiny{\tiny 5337}\fi};
\node[accepting, state] at (6,-8) (n0n1n1n0) {$p?$\,\ifntiny{\tiny 5286}\fi};
\node[accepting, state] at (7,-8) (n0n1n1n1) {$p?$\,\ifntiny{\tiny 5293}\fi};
\node[state] at (3,-6) (n0n0n1) {$\cup$\,\ifntiny{\tiny 5331}\fi};
\node[accepting, state] at (10,-4) (n1n1) {$p?$\,\ifntiny{\tiny 5324}\fi};

\draw[->, thick] (n) edge [near start, left] node {a} (n0);
\draw[->, thick] (n) edge [near start, left] node {b} (n1);
\draw[->, thick] (n0) edge [near start, left] node {} (n0n0);
\draw[->, thick] (n0) edge [near start, left] node {} (n0n1);
\draw[->, thick] (n0n0) edge [near start, right, bend right] node {a} (n0);
\draw[->, thick] (n0n0) edge [near start, left] node {b} (n0n0n1);
\draw[->, thick] (n0n0n1) edge [near start, left] node {} (n0n0n1n0);
\draw[->, thick] (n0n0n1) edge [near start, left] node {} (n0n0n1n1);
\draw[->, thick] (n0n0n1n0) edge [near start, right, bend right] node {b} (n0n0n1);
\draw[->, thick] (n0n0n1n1) edge [near start, left] node {b} (n0n0n1n1n0);
\draw[->, thick] (n0n0n1n1n0) edge [near start, right, bend right] node {x} (n0n0n1n1);
\draw[->, thick] (n0n0n1n1n0) edge [near start, left] node {y} (n0n0n1n1n0n1);
\draw[->, thick] (n0n0n1n1n0n1) edge [near start, left] node {a} (n0n0n1n1n0n1n0);
\draw[->, thick] (n0n0n1n1n0n1n0) edge [near start, left] node {a} (n0n0n1n1n0n1n0n0);
\draw[->, thick] (n0n0n1n1n0n1n0) edge [near start, left, bend left] node {b} (n0n0n1n1n0);
\draw[->, thick] (n0n0n1n1n0n1n0n0) edge [near start, right, bend right] node {x} (n0n0n1n1n0n1n0);
\draw[->, thick] (n0n1) edge [near start, left] node {a} (n0n1n0);
\draw[->, thick] (n0n1) edge [near start, left] node {b} (n0n1n1);
\draw[->, thick] (n0n1n0) edge [near start, right, bend right] node {x} (n0n1);
\draw[->, thick] (n0n1n1) edge [near start, left] node {x} (n0n1n1n0);
\draw[->, thick] (n0n1n1) edge [near start, left] node {y} (n0n1n1n1);
\draw[->, thick] (n0n1n1n0) edge [near start, right, bend right] node {b} (n0n1n1);
\draw[->, thick] (n0n1n1n1) edge [near start, left, bend left] node {a} (n0n1);
\draw[->, thick] (n1) edge [near start, left] node {} (n1n0);
\draw[->, thick] (n1) edge [near start, left] node {} (n1n1);
\draw[->, thick] (n1n0) edge [near start, right, bend right] node {b} (n1);
\draw[->, thick] (n1n1) edge [near start, left] node {b} (n1n1n0);
\draw[->, thick] (n1n1n0) edge [near start, right, bend right] node {x} (n1n1);
\draw[->, thick] (n1n1n0) edge [near start, left] node {y} (n1n1n0n1);
\draw[->, thick] (n1n1n0n1) edge [near start, left] node {a} (n1n1n0n1n0);
\draw[->, thick] (n1n1n0n1n0) edge [near start, left] node {a} (n1n1n0n1n0n0);
\draw[->, thick] (n1n1n0n1n0) edge [near start, left, bend left] node {b} (n1n1n0);
\draw[->, thick] (n1n1n0n1n0n0) edge [near start, right, bend right] node {x} (n1n1n0n1n0);

\end{tikzpicture}
\end{tabular}}}
\end{center}
\end{document}
