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

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

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

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

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

d = A("d")
f = B("f")
g = C("g")
k = D("k")
m = E("m")
j = B("j")
h = E("h")

d.y = g
d.t = h
d.o = h
f.v = j
f.o = j
f.w = j
f.s = g
g.q = d
k.r = j
m.o = h
m.s = h
m.z = k
m.v = k
m.w = f
j.v = f
j.o = f
j.w = f
j.s = g
h.o = m
h.s = m
h.z = k
h.v = k
h.w = j
assert m.w.s.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

d = A("d")
f = B("f")
g = C("g")
k = D("k")
m = E("m")
j = B("j")
h = E("h")

d.y = g
d.t = h
d.o = h
f.v = j
f.o = j
f.w = j
f.s = g
g.q = d
k.r = j
m.o = h
m.s = h
m.z = k
m.v = k
m.w = f
j.v = f
j.o = f
j.w = f
j.s = g
h.o = m
h.s = m
h.z = k
h.v = k
h.w = j
assert m.w.s.q.y.txt == "g"