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

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

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

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

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

i = A("i")
b = B("b")
a = C("a")
l = D("l")
m = E("m")
d = C("d")
n = B("n")
g = C("g")

i.o = n
b.z = m
a.w = l
a.o = g
l.p = m
l.s = m
l.t = i
l.o = i
l.r = b
m.o = d
m.v = b
m.w = n
d.w = l
d.o = a
n.z = m
g.w = l
g.o = a
assert g.o.o.o.o.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

i = A("i")
b = B("b")
a = C("a")
l = D("l")
m = E("m")
d = C("d")
n = B("n")
g = C("g")

i.o = n
b.z = m
a.w = l
a.o = g
l.p = m
l.s = m
l.t = i
l.o = i
l.r = b
m.o = d
m.v = b
m.w = n
d.w = l
d.o = a
n.z = m
g.w = l
g.o = a
assert g.o.o.o.o.w.r.txt == "b"