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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: B = None
        self.txt = txt

e = A("e")
j = B("j")
b = A("b")
a = B("a")
l = A("l")
i = B("i")

e.q = j
e.z = b
j.p = e
j.s = i
b.q = a
b.z = e
a.p = e
a.s = j
l.q = j
l.z = b
i.p = b
i.s = j
assert b.q.p.z.z.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: B = None
        self.txt = txt

e = A("e")
j = B("j")
b = A("b")
a = B("a")
l = A("l")
i = B("i")

e.q = j
e.z = b
j.p = e
j.s = i
b.q = a
b.z = e
a.p = e
a.s = j
l.q = j
l.z = b
i.p = b
i.s = j
assert b.q.p.z.z.q.s.txt == "i"