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

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

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

i = A("i")
n = B("n")
f = C("f")
a = C("a")

i.p = a
n.t = a
n.v = a
f.v = n
f.o = n
a.v = n
a.o = n
assert i.p.v.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

i = A("i")
n = B("n")
f = C("f")
a = C("a")

i.p = a
n.t = a
n.v = a
f.v = n
f.o = n
a.v = n
a.o = n
assert i.p.v.t.o.txt == "n"