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

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

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

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

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

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

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

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

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

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

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

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

e.o = g
e.w = j
j.y = e
a.w = j
a.q = i
a.r = g
h.z = e
h.o = e
h.s = i
h.v = g
g.v = j
i.z = e
i.o = e
i.s = h
i.v = m
f.w = j
f.q = i
f.r = g
m.v = j
assert f.w.y.o.txt == "g"