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

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

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

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

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

h.w = a
j.p = d
j.s = b
j.v = a
j.t = a
a.y = b
a.s = d
b.p = j
b.z = m
b.u = l
l.p = j
l.z = h
l.u = b
m.w = a
d.p = j
d.s = l
d.v = a
d.t = a
assert m.w.s.v.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

h.w = a
j.p = d
j.s = b
j.v = a
j.t = a
a.y = b
a.s = d
b.p = j
b.z = m
b.u = l
l.p = j
l.z = h
l.u = b
m.w = a
d.p = j
d.s = l
d.v = a
d.t = a
assert m.w.s.v.y.p.txt == "j"