class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.x: D = None
        self.u: B = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
k = C("k")
m = D("m")
n = A("n")
b = C("b")
j = A("j")
d = D("d")
g = B("g")

l.y = j
l.z = m
l.x = m
l.u = i
i.z = g
i.u = k
k.u = m
k.z = b
k.w = b
k.q = g
m.w = b
m.p = i
m.s = k
m.q = k
n.y = l
n.z = m
n.x = m
n.u = i
b.u = m
b.z = k
b.w = k
b.q = g
j.y = n
j.z = d
j.x = m
j.u = i
d.w = k
d.p = i
d.s = b
d.q = b
g.z = i
g.u = k
assert b.u.w.q.u.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.x: D = None
        self.u: B = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
k = C("k")
m = D("m")
n = A("n")
b = C("b")
j = A("j")
d = D("d")
g = B("g")

l.y = j
l.z = m
l.x = m
l.u = i
i.z = g
i.u = k
k.u = m
k.z = b
k.w = b
k.q = g
m.w = b
m.p = i
m.s = k
m.q = k
n.y = l
n.z = m
n.x = m
n.u = i
b.u = m
b.z = k
b.w = k
b.q = g
j.y = n
j.z = d
j.x = m
j.u = i
d.w = k
d.p = i
d.s = b
d.q = b
g.z = i
g.u = k
assert b.u.w.q.u.q.z.txt == "i"