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

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

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

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

n = A("n")
c = B("c")
k = C("k")
e = D("e")

n.r = k
c.s = k
c.w = k
k.u = e
e.t = c
e.u = k
assert k.u.t.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

n = A("n")
c = B("c")
k = C("k")
e = D("e")

n.r = k
c.s = k
c.w = k
k.u = e
e.t = c
e.u = k
assert k.u.t.s.u.txt == "e"