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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: A = None
        self.z: B = None
        self.q: A = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: A = None
        self.z: B = None
        self.q: A = None
        self.u: E = None
        self.txt = txt

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

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

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

a.p = h
a.y = m
a.v = k
h.o = a
h.y = a
h.q = f
k.o = m
k.u = m
k.t = a
k.q = a
k.z = d
f.w = j
f.q = k
m.x = d
j.w = f
j.q = k
b.w = j
b.q = k
d.o = a
d.y = a
d.q = f
assert d.y.v.q.y.x.q.q.txt == "k"