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

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

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

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

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

j = A("j")
m = B("m")
d = C("d")
a = D("a")
k = E("k")
b = B("b")
h = D("h")

j.v = k
j.p = k
j.x = m
j.s = b
j.o = h
m.p = k
d.o = h
d.q = a
d.x = m
a.v = k
a.w = m
k.z = m
k.w = j
b.p = k
h.v = k
h.w = m
assert b.p.w.x.p.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: E = None
        self.x: B = None
        self.s: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

j = A("j")
m = B("m")
d = C("d")
a = D("a")
k = E("k")
b = B("b")
h = D("h")

j.v = k
j.p = k
j.x = m
j.s = b
j.o = h
m.p = k
d.o = h
d.q = a
d.x = m
a.v = k
a.w = m
k.z = m
k.w = j
b.p = k
h.v = k
h.w = m
assert b.p.w.x.p.z.p.z.txt == "m"