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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

g.u = i
h.s = a
h.o = l
h.p = j
h.z = g
i.p = k
l.o = g
l.s = g
e.w = h
k.o = g
k.s = g
j.p = k
m.o = g
m.s = g
a.o = g
a.s = g
assert i.p.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

g.u = i
h.s = a
h.o = l
h.p = j
h.z = g
i.p = k
l.o = g
l.s = g
e.w = h
k.o = g
k.s = g
j.p = k
m.o = g
m.s = g
a.o = g
a.s = g
assert i.p.o.u.txt == "i"