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

\node[accepting, state] at (4,-8) (n0n0n1n0) {$q!$\,\ifntiny{\tiny 3471}\fi};
\node[accepting, state] at (1,-12) (n0n0n0n0n1n0) {$q!$\,\ifntiny{\tiny 3161}\fi};
\node[accepting, state] at (6,-4) (n1n0) {$q!$\,\ifntiny{\tiny 11}\fi};
\node[initial, state] at (4,0) (n) {$\cup$\,\ifntiny{\tiny 3563}\fi};
\node[accepting, state] at (5,-6) (n0n0n1) {$p!$\,\ifntiny{\tiny 3476}\fi};
\node[state] at (3,-2) (n0) {$p!$\,\ifntiny{\tiny 3562}\fi};
\node[accepting, state] at (2,-10) (n0n0n0n0n1) {$p!$\,\ifntiny{\tiny 3170}\fi};
\node[accepting, state] at (7,-2) (n1) {$p!$\,\ifntiny{\tiny 13}\fi};
\node[state] at (1,-8) (n0n0n0n0) {$\cup$\,\ifntiny{\tiny 3558}\fi};
\node[state] at (2,-6) (n0n0n0) {$p!$\,\ifntiny{\tiny 3559}\fi};
\node[state] at (3,-4) (n0n0) {$\cup$\,\ifntiny{\tiny 3561}\fi};

\draw[->, thick] (n) edge [near start, left] node {} (n0);
\draw[->, thick] (n) edge [near start, left] node {} (n1);
\draw[->, thick] (n0) edge [near start, left] node {a} (n0n0);
\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, right, bend right] node {b} (n0);
\draw[->, thick] (n0n0n0n0) edge [near start, right, bend right] node {} (n0n0n0);
\draw[->, thick] (n0n0n0n0) edge [near start, left] node {} (n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n1) edge [near start, left] node {a} (n0n0n0n0n1n0);
\draw[->, thick] (n0n0n0n0n1) edge [near start, above, loop left] node {b} (n0n0n0n0n1);
\draw[->, thick] (n0n0n0n0n1n0) edge [near start, right, bend right] node {a} (n0n0n0n0n1);
\draw[->, thick] (n0n0n1) edge [near start, left] node {a} (n0n0n1n0);
\draw[->, thick] (n0n0n1) edge [near start, above, loop left] node {b} (n0n0n1);
\draw[->, thick] (n0n0n1n0) edge [near start, right, bend right] node {a} (n0n0n1);
\draw[->, thick] (n1) edge [near start, left] node {a} (n1n0);
\draw[->, thick] (n1) edge [near start, above, loop left] node {b} (n1);
\draw[->, thick] (n1n0) edge [near start, right, bend right] node {a} (n1);

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