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

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

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

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

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

j.w = b
j.y = a
m.z = j
m.x = j
n.t = j
n.z = j
n.u = j
n.w = m
g.s = j
g.y = m
g.t = m
g.w = a
a.s = j
a.y = m
a.t = m
a.w = g
l.s = j
l.y = m
l.t = m
l.w = g
b.t = j
b.z = j
b.u = j
b.w = m
assert j.w.u.y.s.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

j.w = b
j.y = a
m.z = j
m.x = j
n.t = j
n.z = j
n.u = j
n.w = m
g.s = j
g.y = m
g.t = m
g.w = a
a.s = j
a.y = m
a.t = m
a.w = g
l.s = j
l.y = m
l.t = m
l.w = g
b.t = j
b.z = j
b.u = j
b.w = m
assert j.w.u.y.s.w.t.w.txt == "b"