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

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

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

f = A("f")
i = B("i")
e = C("e")
b = A("b")
j = A("j")
l = B("l")

f.t = e
f.z = l
f.y = j
i.z = b
i.t = e
i.w = e
e.q = j
b.t = e
b.z = i
b.y = f
j.t = e
j.z = i
j.y = b
l.z = f
l.t = e
l.w = e
assert b.z.t.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: B = None
        self.y: A = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
e = C("e")
b = A("b")
j = A("j")
l = B("l")

f.t = e
f.z = l
f.y = j
i.z = b
i.t = e
i.w = e
e.q = j
b.t = e
b.z = i
b.y = f
j.t = e
j.z = i
j.y = b
l.z = f
l.t = e
l.w = e
assert b.z.t.q.z.txt == "i"