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

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

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

j = A("j")
i = B("i")
c = C("c")
f = A("f")
n = A("n")

j.p = i
j.t = i
j.o = i
i.z = c
c.s = i
c.t = n
f.p = i
f.t = i
f.o = i
n.p = i
n.t = i
n.o = i
assert c.s.z.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
i = B("i")
c = C("c")
f = A("f")
n = A("n")

j.p = i
j.t = i
j.o = i
i.z = c
c.s = i
c.t = n
f.p = i
f.t = i
f.o = i
n.p = i
n.t = i
n.o = i
assert c.s.z.t.o.txt == "i"