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

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

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

d = A("d")
c = B("c")
j = C("j")
k = C("k")
i = B("i")
e = C("e")
a = A("a")

d.t = k
d.w = i
d.o = a
c.u = e
j.s = d
j.o = d
k.s = a
k.o = a
i.u = k
e.s = a
e.o = d
a.t = j
a.w = i
a.o = d
assert k.s.t.s.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.o: A = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
j = C("j")
k = C("k")
i = B("i")
e = C("e")
a = A("a")

d.t = k
d.w = i
d.o = a
c.u = e
j.s = d
j.o = d
k.s = a
k.o = a
i.u = k
e.s = a
e.o = d
a.t = j
a.w = i
a.o = d
assert k.s.t.s.o.t.txt == "j"