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

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

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

i = A("i")
h = B("h")
d = C("d")
e = C("e")
k = A("k")
f = C("f")
n = C("n")
a = C("a")

i.w = h
i.p = h
i.t = f
h.y = k
d.s = h
e.s = h
k.w = h
k.p = h
k.t = d
f.s = h
n.s = h
a.s = h
assert a.s.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: B = None
        self.t: C = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
d = C("d")
e = C("e")
k = A("k")
f = C("f")
n = C("n")
a = C("a")

i.w = h
i.p = h
i.t = f
h.y = k
d.s = h
e.s = h
k.w = h
k.p = h
k.t = d
f.s = h
n.s = h
a.s = h
assert a.s.y.t.txt == "d"