class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: C = None
        self.x: C = None
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

h = A("h")
d = B("d")
n = C("n")
m = D("m")
i = E("i")
j = D("j")

h.w = j
h.z = n
h.x = n
h.q = i
h.p = i
d.r = h
n.r = h
m.o = n
m.s = n
m.t = j
m.v = d
i.p = d
i.y = n
j.o = n
j.s = n
j.t = m
j.v = d
assert d.r.w.o.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: C = None
        self.x: C = None
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

h = A("h")
d = B("d")
n = C("n")
m = D("m")
i = E("i")
j = D("j")

h.w = j
h.z = n
h.x = n
h.q = i
h.p = i
d.r = h
n.r = h
m.o = n
m.s = n
m.t = j
m.v = d
i.p = d
i.y = n
j.o = n
j.s = n
j.t = m
j.v = d
assert d.r.w.o.r.q.txt == "i"