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

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

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

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

a = A("a")
b = B("b")
i = C("i")
n = D("n")
h = A("h")
l = A("l")
e = C("e")
g = B("g")
k = C("k")
j = B("j")

a.u = b
a.s = j
a.v = e
b.w = g
b.t = j
b.v = e
b.x = l
i.q = j
n.s = j
n.p = b
n.z = e
n.t = a
h.u = g
h.s = j
h.v = k
l.u = g
l.s = j
l.v = e
e.q = j
g.w = j
g.t = b
g.v = i
g.x = l
k.q = g
j.w = g
j.t = g
j.v = i
j.x = h
assert j.x.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.v: C = None
        self.txt = txt

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

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

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

a = A("a")
b = B("b")
i = C("i")
n = D("n")
h = A("h")
l = A("l")
e = C("e")
g = B("g")
k = C("k")
j = B("j")

a.u = b
a.s = j
a.v = e
b.w = g
b.t = j
b.v = e
b.x = l
i.q = j
n.s = j
n.p = b
n.z = e
n.t = a
h.u = g
h.s = j
h.v = k
l.u = g
l.s = j
l.v = e
e.q = j
g.w = j
g.t = b
g.v = i
g.x = l
k.q = g
j.w = g
j.t = g
j.v = i
j.x = h
assert j.x.u.w.x.txt == "h"