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

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

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

m = A("m")
l = B("l")
n = C("n")
b = D("b")
i = C("i")
j = D("j")

m.s = i
m.q = l
m.r = l
l.y = b
l.w = j
n.r = j
n.w = j
n.x = l
n.q = m
b.s = j
b.r = j
b.y = l
b.x = l
i.r = j
i.w = j
i.x = l
i.q = m
j.s = b
j.r = b
j.y = l
j.x = l
assert b.x.w.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: B = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

m = A("m")
l = B("l")
n = C("n")
b = D("b")
i = C("i")
j = D("j")

m.s = i
m.q = l
m.r = l
l.y = b
l.w = j
n.r = j
n.w = j
n.x = l
n.q = m
b.s = j
b.r = j
b.y = l
b.x = l
i.r = j
i.w = j
i.x = l
i.q = m
j.s = b
j.r = b
j.y = l
j.x = l
assert b.x.w.x.w.txt == "j"