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

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

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

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

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

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

e.y = f
e.o = d
g.u = m
d.u = h
d.z = g
d.s = i
m.r = e
m.v = d
b.q = f
b.s = f
b.v = d
b.o = h
b.z = i
j.y = f
j.o = d
f.u = h
h.r = c
h.v = d
c.y = f
c.o = d
i.q = g
i.s = g
i.v = d
i.o = m
i.z = b
assert i.q.u.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

e.y = f
e.o = d
g.u = m
d.u = h
d.z = g
d.s = i
m.r = e
m.v = d
b.q = f
b.s = f
b.v = d
b.o = h
b.z = i
j.y = f
j.o = d
f.u = h
h.r = c
h.v = d
c.y = f
c.o = d
i.q = g
i.s = g
i.v = d
i.o = m
i.z = b
assert i.q.u.r.y.txt == "f"