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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.u: C = None
        self.s: B = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
h = D("h")
l = B("l")
j = D("j")

b.w = j
b.y = h
b.u = l
b.s = g
g.x = h
g.t = h
g.p = m
g.s = b
m.r = h
h.y = b
h.p = l
h.u = m
h.s = g
l.x = h
l.t = h
l.p = m
l.s = b
j.y = b
j.p = g
j.u = m
j.s = l
assert m.r.p.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: D = None
        self.u: B = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.u: C = None
        self.s: B = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
h = D("h")
l = B("l")
j = D("j")

b.w = j
b.y = h
b.u = l
b.s = g
g.x = h
g.t = h
g.p = m
g.s = b
m.r = h
h.y = b
h.p = l
h.u = m
h.s = g
l.x = h
l.t = h
l.p = m
l.s = b
j.y = b
j.p = g
j.u = m
j.s = l
assert m.r.p.s.y.txt == "h"