class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

k = A("k")
g = B("g")
i = C("i")
l = D("l")
e = C("e")
c = D("c")

k.w = i
k.u = l
g.x = k
i.s = c
l.t = c
e.s = l
c.t = l
assert l.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

k = A("k")
g = B("g")
i = C("i")
l = D("l")
e = C("e")
c = D("c")

k.w = i
k.u = l
g.x = k
i.s = c
l.t = c
e.s = l
c.t = l
assert l.t.t.t.t.t.txt == "c"