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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: D = None
        self.s: D = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: D = None
        self.r: A = None
        self.o: B = None
        self.txt = txt

l = A("l")
g = B("g")
h = C("h")
n = D("n")
e = D("e")
m = A("m")
a = C("a")
d = D("d")

l.z = e
l.w = h
g.s = m
h.u = a
h.q = e
h.s = e
h.v = l
n.t = m
n.x = e
n.r = l
n.o = g
e.t = m
e.x = n
e.r = l
e.o = g
m.z = e
m.w = h
a.u = h
a.q = n
a.s = e
a.v = l
d.t = l
d.x = e
d.r = m
d.o = g
assert a.v.w.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: D = None
        self.s: D = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: D = None
        self.r: A = None
        self.o: B = None
        self.txt = txt

l = A("l")
g = B("g")
h = C("h")
n = D("n")
e = D("e")
m = A("m")
a = C("a")
d = D("d")

l.z = e
l.w = h
g.s = m
h.u = a
h.q = e
h.s = e
h.v = l
n.t = m
n.x = e
n.r = l
n.o = g
e.t = m
e.x = n
e.r = l
e.o = g
m.z = e
m.w = h
a.u = h
a.q = n
a.s = e
a.v = l
d.t = l
d.x = e
d.r = m
d.o = g
assert a.v.w.q.t.txt == "m"