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

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

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

g = A("g")
l = B("l")
e = C("e")
k = C("k")

g.t = l
g.p = e
l.y = g
l.t = g
e.o = k
e.z = k
e.w = g
k.o = e
k.z = e
k.w = g
assert k.w.t.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
e = C("e")
k = C("k")

g.t = l
g.p = e
l.y = g
l.t = g
e.o = k
e.z = k
e.w = g
k.o = e
k.z = e
k.w = g
assert k.w.t.t.p.txt == "e"