class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

n = A("n")
e = B("e")
b = A("b")
j = A("j")
k = B("k")
a = B("a")
h = A("h")
c = B("c")

n.x = j
n.t = b
e.q = c
e.t = a
b.x = h
b.t = j
j.x = n
j.t = n
k.q = e
k.t = e
a.q = c
a.t = c
h.x = b
h.t = n
c.q = e
c.t = e
assert b.x.t.x.x.t.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

n = A("n")
e = B("e")
b = A("b")
j = A("j")
k = B("k")
a = B("a")
h = A("h")
c = B("c")

n.x = j
n.t = b
e.q = c
e.t = a
b.x = h
b.t = j
j.x = n
j.t = n
k.q = e
k.t = e
a.q = c
a.t = c
h.x = b
h.t = n
c.q = e
c.t = e
assert b.x.t.x.x.t.t.x.txt == "n"