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

\node[initial, state] at (5,0) (n) {$p?$\,\ifntiny{\tiny 985}\fi};
\node[accepting, state] at (1,-14) (n0n0n0n0n0n0n1) {$p!$\,\ifntiny{\tiny 902}\fi};
\node[accepting, state] at (8,-4) (n0n1) {$p!$\,\ifntiny{\tiny 935}\fi};
\node[accepting, state] at (3,-14) (n0n0n0n0n0n1n1) {$p!$\,\ifntiny{\tiny 887}\fi};
\node[accepting, state] at (7,-6) (n0n0n1) {$p?$\,\ifntiny{\tiny 957}\fi};
\node[state] at (4,-2) (n0) {$p?$\,\ifntiny{\tiny 984}\fi};
\node[accepting, state] at (3,-12) (n0n0n0n0n0n1) {$p?$\,\ifntiny{\tiny 888}\fi};
\node[accepting, state] at (4,-10) (n0n0n0n0n1) {$p!$\,\ifntiny{\tiny 902}\fi};
\node[accepting, state] at (9,-2) (n1) {$p!$\,\ifntiny{\tiny 824}\fi};
\node[accepting, state] at (6,-8) (n0n0n1n0) {$p!$\,\ifntiny{\tiny 949}\fi};
\node[accepting, state] at (7,-8) (n0n0n1n1) {$p!$\,\ifntiny{\tiny 956}\fi};
\node[state] at (1,-12) (n0n0n0n0n0n0) {$p?$\,\ifntiny{\tiny 976}\fi};
\node[state] at (2,-10) (n0n0n0n0n0) {$\cup$\,\ifntiny{\tiny 977}\fi};
\node[state] at (2,-8) (n0n0n0n0) {$p?$\,\ifntiny{\tiny 979}\fi};
\node[state] at (3,-6) (n0n0n0) {$p?$\,\ifntiny{\tiny 981}\fi};
\node[state] at (4,-4) (n0n0) {$\cup$\,\ifntiny{\tiny 982}\fi};
\node[accepting, state] at (5,-8) (n0n0n0n1) {$p!$\,\ifntiny{\tiny 919}\fi};
\node[accepting, state] at (2,-14) (n0n0n0n0n0n1n0) {$p!$\,\ifntiny{\tiny 874}\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 {a} (n0n0);
\draw[->, thick] (n0) edge [near start, left] node {b} (n0n1);
\draw[->, thick] (n0n0) edge [near start, left] node {} (n0n0n0);
\draw[->, thick] (n0n0) edge [near start, left] node {} (n0n0n1);
\draw[->, thick] (n0n0n0) edge [near start, left] node {a} (n0n0n0n0);
\draw[->, thick] (n0n0n0) edge [near start, left] node {b} (n0n0n0n1);
\draw[->, thick] (n0n0n0n0) edge [near start, left] node {a} (n0n0n0n0n0);
\draw[->, thick] (n0n0n0n0) edge [near start, left] node {b} (n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n0) edge [near start, left] node {} (n0n0n0n0n0n0);
\draw[->, thick] (n0n0n0n0n0) edge [near start, left] node {} (n0n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n0n0) edge [near start, right, bend right] node {a} (n0n0n0n0n0);
\draw[->, thick] (n0n0n0n0n0n0) edge [near start, left] node {b} (n0n0n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n0n0n1) edge [near start, above, loop left] node {x} (n0n0n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n0n1) edge [near start, left] node {a} (n0n0n0n0n0n1n0);
\draw[->, thick] (n0n0n0n0n0n1) edge [near start, left] node {b} (n0n0n0n0n0n1n1);
\draw[->, thick] (n0n0n0n0n0n1n0) edge [near start, right, bend right] node {x} (n0n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n0n1n1) edge [near start, above, loop left] node {x} (n0n0n0n0n0n1n1);
\draw[->, thick] (n0n0n0n0n1) edge [near start, above, loop left] node {x} (n0n0n0n0n1);
\draw[->, thick] (n0n0n0n1) edge [near start, above, loop left] node {x} (n0n0n0n1);
\draw[->, thick] (n0n0n1) edge [near start, left] node {a} (n0n0n1n0);
\draw[->, thick] (n0n0n1) edge [near start, left] node {b} (n0n0n1n1);
\draw[->, thick] (n0n0n1n0) edge [near start, right, bend right] node {x} (n0n0n1);
\draw[->, thick] (n0n0n1n1) edge [near start, above, loop left] node {x} (n0n0n1n1);
\draw[->, thick] (n0n1) edge [near start, above, loop left] node {x} (n0n1);
\draw[->, thick] (n1) edge [near start, above, loop left] node {x} (n1);

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