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

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

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

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

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

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

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

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

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

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

h.u = j
h.v = n
j.z = h
j.q = h
j.x = n
j.v = m
n.v = a
n.u = d
m.s = b
m.z = c
m.v = n
m.w = j
c.s = j
c.z = d
c.v = n
c.w = b
a.s = b
a.w = b
a.z = m
a.v = n
b.z = h
b.q = h
b.x = n
b.v = c
d.s = j
d.w = j
d.z = a
d.v = n
assert n.v.s.q.txt == "h"