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

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

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

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

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

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

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

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

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

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

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