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

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

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

k = A("k")
a = B("a")
d = C("d")
l = C("l")
h = B("h")

k.x = a
a.s = h
a.u = h
d.p = k
d.t = k
l.p = k
l.t = k
h.s = a
h.u = a
assert k.x.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
d = C("d")
l = C("l")
h = B("h")

k.x = a
a.s = h
a.u = h
d.p = k
d.t = k
l.p = k
l.t = k
h.s = a
h.u = a
assert k.x.s.u.txt == "a"