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

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

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

c = A("c")
k = B("k")
f = C("f")
j = C("j")
n = A("n")
d = C("d")

c.x = j
c.v = f
k.t = c
k.o = d
f.p = k
j.p = k
n.x = f
n.v = d
d.p = k
assert c.x.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: C = None
        self.txt = txt

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

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

c = A("c")
k = B("k")
f = C("f")
j = C("j")
n = A("n")
d = C("d")

c.x = j
c.v = f
k.t = c
k.o = d
f.p = k
j.p = k
n.x = f
n.v = d
d.p = k
assert c.x.p.o.txt == "d"