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

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

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

d = A("d")
k = B("k")
i = C("i")
l = A("l")
h = A("h")
g = C("g")
m = A("m")
b = C("b")

d.x = k
k.w = l
i.s = l
i.u = k
i.t = b
l.x = k
h.x = k
g.s = d
g.u = k
g.t = b
m.x = k
b.s = d
b.u = k
b.t = i
assert h.x.w.x.w.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
i = C("i")
l = A("l")
h = A("h")
g = C("g")
m = A("m")
b = C("b")

d.x = k
k.w = l
i.s = l
i.u = k
i.t = b
l.x = k
h.x = k
g.s = d
g.u = k
g.t = b
m.x = k
b.s = d
b.u = k
b.t = i
assert h.x.w.x.w.x.w.txt == "l"