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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: A = None
        self.o: A = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.v: D = None
        self.txt = txt

l = A("l")
m = B("m")
i = C("i")
a = D("a")
e = E("e")
g = B("g")
h = E("h")
k = C("k")

l.u = g
l.s = h
m.s = e
m.r = l
m.o = l
m.y = g
i.r = m
i.q = m
a.z = m
e.p = h
e.w = h
e.v = a
g.s = e
g.r = l
g.o = l
g.y = m
h.p = e
h.w = e
h.v = a
k.r = m
k.q = g
assert a.z.s.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: A = None
        self.o: A = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.v: D = None
        self.txt = txt

l = A("l")
m = B("m")
i = C("i")
a = D("a")
e = E("e")
g = B("g")
h = E("h")
k = C("k")

l.u = g
l.s = h
m.s = e
m.r = l
m.o = l
m.y = g
i.r = m
i.q = m
a.z = m
e.p = h
e.w = h
e.v = a
g.s = e
g.r = l
g.o = l
g.y = m
h.p = e
h.w = e
h.v = a
k.r = m
k.q = g
assert a.z.s.v.z.txt == "m"