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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: B = None
        self.q: D = None
        self.o: E = None
        self.r: 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.z: B = None
        self.o: E = None
        self.v: E = None
        self.s: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: D = None
        self.v: B = None
        self.p: A = None
        self.txt = txt

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

e.q = h
j.z = m
j.o = m
j.x = f
j.r = f
j.q = d
b.q = e
d.z = j
d.q = j
d.o = h
d.s = h
d.v = m
m.r = j
m.t = d
m.v = f
m.p = e
f.z = m
f.o = m
f.x = j
f.r = j
f.q = d
h.r = j
h.t = d
h.v = f
h.p = e
assert d.v.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: B = None
        self.q: D = None
        self.o: E = None
        self.r: 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.z: B = None
        self.o: E = None
        self.v: E = None
        self.s: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: D = None
        self.v: B = None
        self.p: A = None
        self.txt = txt

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

e.q = h
j.z = m
j.o = m
j.x = f
j.r = f
j.q = d
b.q = e
d.z = j
d.q = j
d.o = h
d.s = h
d.v = m
m.r = j
m.t = d
m.v = f
m.p = e
f.z = m
f.o = m
f.x = j
f.r = j
f.q = d
h.r = j
h.t = d
h.v = f
h.p = e
assert d.v.p.q.txt == "h"