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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

j = A("j")
l = B("l")
i = C("i")
d = D("d")
h = A("h")
g = C("g")
n = B("n")
c = D("c")
m = C("m")

j.x = i
j.v = i
j.s = c
l.v = c
i.o = n
d.u = c
d.w = j
d.q = n
h.x = g
h.s = d
h.v = i
g.o = n
n.v = c
c.u = d
c.w = h
c.q = l
m.o = l
assert h.v.o.v.q.v.w.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: D = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

j = A("j")
l = B("l")
i = C("i")
d = D("d")
h = A("h")
g = C("g")
n = B("n")
c = D("c")
m = C("m")

j.x = i
j.v = i
j.s = c
l.v = c
i.o = n
d.u = c
d.w = j
d.q = n
h.x = g
h.s = d
h.v = i
g.o = n
n.v = c
c.u = d
c.w = h
c.q = l
m.o = l
assert h.v.o.v.q.v.w.x.o.txt == "n"