broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'pages': [[seed-1]], 'current': payload[:], 'queued': phase=='queued', 'spool_owned': phase not in ('printing','done'), 'engine_owned': phase in ('printing','held'), 'reported': None}
    frames = []
    observed = []
    table = {('idle', 'declare_job'): ('declared', 'reserve_spool'), ('declared', 'page_begin'): ('page', 'create_page'), ('page', 'page_end'): ('declared', 'seal_page'), ('declared', 'job_end'): ('queued', 'enqueue_job'), ('page', 'job_end'): ('page', 'reject_unsealed'), ('queued', 'engine_accept'): ('printing', 'transfer_ownership'), ('printing', 'completed'): ('printing', 'wait'), ('printing', 'paper_fault'): ('held', 'report_intervention'), ('held', 'operator_resume'): ('printing', 'resume_engine'), ('queued', 'cancel_job'): ('cancelled', 'dequeue_delete')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'reserve_spool':
            r['spool_owned']=True; frames.append(['JOB_RESERVED',seed])
        elif action == 'create_page':
            r['current']=[]
        elif action == 'seal_page':
            r['pages'].append(r['current'][:]); r['current']=[]
        elif action == 'enqueue_job':
            r['queued']=True; frames.append(['JOB_QUEUED',seed])
        elif action == 'reject_unsealed':
            frames.append(['UNSEALED_PAGE',seed])
        elif action == 'transfer_ownership':
            r['spool_owned']=False; r['engine_owned']=True; r['queued']=False
        elif action == 'report_success':
            r['reported']='success'
        elif action == 'report_intervention':
            r['reported']='intervention'
        elif action == 'resume_engine':
            frames.append(['RESUME_ENGINE',seed])
        elif action == 'dequeue_delete':
            r['queued']=False; r['pages']=[]; r['current']=[]; r['spool_owned']=False
        elif action == 'start_engine':
            r['engine_owned']=True
        elif action == 'accept_pages':
            r['pages'].append(payload)
        elif action == 'append_previous':
            r['current'].extend(payload)
        elif action == 'discard_page':
            r['current']=[]
        elif action == 'start_partial':
            r['engine_owned']=True; r['pages'].append(r['current'][:1])
        elif action == 'discard_job':
            r['pages']=[]; r['current']=[]
        elif action == 'enqueue_again':
            frames.append(['JOB_QUEUED',seed]); r['queued']=True
        elif action == 'retain_sender_ownership':
            r['engine_owned']=True; r['spool_owned']=True
        elif action == 'report_accepted':
            r['reported']='accepted'
        elif action == 'delete_spool':
            r['pages']=[]; r['current']=[]
        elif action == 'restart_entire_job':
            frames.append(['PRINT_FROM_PAGE',0])
        elif action == 'delete_without_dequeue':
            r['pages']=[]; r['current']=[]; r['spool_owned']=False
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[0]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[0], [1, 2, 3]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 1]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 1]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1]]}, {'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}, {'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 1], ['RESUME_ENGINE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[1]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[1], [2, 3, 4, 5]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 2]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 2]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume'], [{'phase': 'declared', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2]]}, {'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[2]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[2], [3, 4, 5, 6, 7]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 3]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 3]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3]]}, {'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3], ['RESUME_ENGINE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[3]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[3], [4, 5, 6, 7, 8, 9]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 4]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 4]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'declared', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4]]}, {'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[4]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[4], [5, 6, 7, 8, 9, 10, 11]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 5]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 5]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5]]}, {'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'pages': [[seed-1]], 'current': payload[:], 'queued': phase=='queued', 'spool_owned': phase not in ('printing','done'), 'engine_owned': phase in ('printing','held'), 'reported': None}
    frames = []
    observed = []
    table = {('idle', 'declare_job'): ('declared', 'reserve_spool'), ('declared', 'page_begin'): ('page', 'create_page'), ('page', 'page_end'): ('declared', 'seal_page'), ('declared', 'job_end'): ('queued', 'enqueue_job'), ('page', 'job_end'): ('page', 'reject_unsealed'), ('queued', 'engine_accept'): ('printing', 'transfer_ownership'), ('printing', 'completed'): ('done', 'report_accepted'), ('printing', 'paper_fault'): ('held', 'report_intervention'), ('held', 'operator_resume'): ('printing', 'resume_engine'), ('queued', 'cancel_job'): ('cancelled', 'dequeue_delete')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'reserve_spool':
            r['spool_owned']=True; frames.append(['JOB_RESERVED',seed])
        elif action == 'create_page':
            r['current']=[]
        elif action == 'seal_page':
            r['pages'].append(r['current'][:]); r['current']=[]
        elif action == 'enqueue_job':
            r['queued']=True; frames.append(['JOB_QUEUED',seed])
        elif action == 'reject_unsealed':
            frames.append(['UNSEALED_PAGE',seed])
        elif action == 'transfer_ownership':
            r['spool_owned']=False; r['engine_owned']=True; r['queued']=False
        elif action == 'report_success':
            r['reported']='success'
        elif action == 'report_intervention':
            r['reported']='intervention'
        elif action == 'resume_engine':
            frames.append(['RESUME_ENGINE',seed])
        elif action == 'dequeue_delete':
            r['queued']=False; r['pages']=[]; r['current']=[]; r['spool_owned']=False
        elif action == 'start_engine':
            r['engine_owned']=True
        elif action == 'accept_pages':
            r['pages'].append(payload)
        elif action == 'append_previous':
            r['current'].extend(payload)
        elif action == 'discard_page':
            r['current']=[]
        elif action == 'start_partial':
            r['engine_owned']=True; r['pages'].append(r['current'][:1])
        elif action == 'discard_job':
            r['pages']=[]; r['current']=[]
        elif action == 'enqueue_again':
            frames.append(['JOB_QUEUED',seed]); r['queued']=True
        elif action == 'retain_sender_ownership':
            r['engine_owned']=True; r['spool_owned']=True
        elif action == 'report_accepted':
            r['reported']='accepted'
        elif action == 'delete_spool':
            r['pages']=[]; r['current']=[]
        elif action == 'restart_entire_job':
            frames.append(['PRINT_FROM_PAGE',0])
        elif action == 'delete_without_dequeue':
            r['pages']=[]; r['current']=[]; r['spool_owned']=False
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[0]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[0], [1, 2, 3]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 1]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 1]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1]]}, {'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}, {'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 1], ['JOB_QUEUED', 1]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'held', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 1]]}, {'phase': 'printing', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 1], ['RESUME_ENGINE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[0]], 'current': [1, 2, 3], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[1]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[1], [2, 3, 4, 5]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 2]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 2]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume'], [{'phase': 'declared', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2]]}, {'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 2], ['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'queued', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2]]}, {'phase': 'printing', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}, {'phase': 'held', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 2], ['RESUME_ENGINE', 2]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[1]], 'current': [2, 3, 4, 5], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[2]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[2], [3, 4, 5, 6, 7]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 3]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 3]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3]]}, {'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 3], ['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'held', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3]]}, {'phase': 'printing', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 3], ['RESUME_ENGINE', 3], ['RESUME_ENGINE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[2]], 'current': [3, 4, 5, 6, 7], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[3]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[3], [4, 5, 6, 7, 8, 9]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 4]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 4]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'declared', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4]]}, {'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 4], ['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'queued', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'printing', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}, {'phase': 'held', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 4], ['RESUME_ENGINE', 4], ['RESUME_ENGINE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[3]], 'current': [4, 5, 6, 7, 8, 9], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/declare_job', 'idle', ['declare_job'], [{'phase': 'declared', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5]]}]), ('declared/page_begin', 'declared', ['page_begin'], [{'phase': 'page', 'registers': {'pages': [[4]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('page/page_end', 'page', ['page_end'], [{'phase': 'declared', 'registers': {'pages': [[4], [5, 6, 7, 8, 9, 10, 11]], 'current': [], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('declared/job_end', 'declared', ['job_end'], [{'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}]), ('page/job_end', 'page', ['job_end'], [{'phase': 'page', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['UNSEALED_PAGE', 5]]}]), ('queued/engine_accept', 'queued', ['engine_accept'], [{'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': []}]), ('printing/completed', 'printing', ['completed'], [{'phase': 'done', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'success'}, 'frames': []}]), ('printing/paper_fault', 'printing', ['paper_fault'], [{'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': []}]), ('held/operator_resume', 'held', ['operator_resume'], [{'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': True, 'reported': None}, 'frames': [['RESUME_ENGINE', 5]]}]), ('queued/cancel_job', 'queued', ['cancel_job'], [{'phase': 'cancelled', 'registers': {'pages': [], 'current': [], 'queued': False, 'spool_owned': False, 'engine_owned': False, 'reported': None}, 'frames': []}]), ('ordered trace 0', 'idle', ['declare_job', 'job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault'], [{'phase': 'declared', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5]]}, {'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_RESERVED', 5], ['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}]), ('ordered trace 3', 'declared', ['job_end', 'engine_accept', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume', 'paper_fault', 'operator_resume'], [{'phase': 'queued', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': True, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': None}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'held', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}, {'phase': 'printing', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': False, 'engine_owned': True, 'reported': 'intervention'}, 'frames': [['JOB_QUEUED', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5], ['RESUME_ENGINE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'pages': [[4]], 'current': [5, 6, 7, 8, 9, 10, 11], 'queued': False, 'spool_owned': True, 'engine_owned': False, 'reported': None}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
While printing, event completed produces printing/wait instead of done/report_success.

For the stipulated Print-spool job transfer controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.

split: open-access