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

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

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

h.w = a
h.q = f
h.r = j
h.t = j
a.v = m
a.x = d
a.z = c
d.s = c
c.z = j
c.v = j
f.w = m
f.q = h
f.r = d
f.t = d
j.s = c
l.w = m
l.q = h
l.r = d
l.t = j
m.v = a
m.x = d
m.z = c
assert f.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: A = None
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

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

h.w = a
h.q = f
h.r = j
h.t = j
a.v = m
a.x = d
a.z = c
d.s = c
c.z = j
c.v = j
f.w = m
f.q = h
f.r = d
f.t = d
j.s = c
l.w = m
l.q = h
l.r = d
l.t = j
m.v = a
m.x = d
m.z = c
assert f.w.z.z.txt == "j"