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

class B:
    def __init__(self, txt: str):
        self.t: C = 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.v: B = None
        self.u: B = None
        self.r: B = None
        self.txt = txt

g = A("g")
n = B("n")
k = C("k")
b = D("b")

g.w = b
g.x = b
g.s = k
g.o = n
n.t = k
k.s = b
b.v = n
b.u = n
b.r = n
assert k.s.r.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: C = None
        self.o: B = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = 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.v: B = None
        self.u: B = None
        self.r: B = None
        self.txt = txt

g = A("g")
n = B("n")
k = C("k")
b = D("b")

g.w = b
g.x = b
g.s = k
g.o = n
n.t = k
k.s = b
b.v = n
b.u = n
b.r = n
assert k.s.r.t.s.txt == "b"