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

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
g = D("g")
l = E("l")
b = E("b")
e = E("e")
n = A("n")

j.q = h
j.x = g
j.z = l
k.q = j
k.p = h
h.v = b
g.o = h
l.y = b
l.s = b
l.o = g
l.x = j
b.y = e
b.o = g
b.x = n
b.s = l
e.y = b
e.o = g
e.x = n
e.s = l
n.q = h
n.x = g
n.z = l
assert h.v.y.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

j = A("j")
k = B("k")
h = C("h")
g = D("g")
l = E("l")
b = E("b")
e = E("e")
n = A("n")

j.q = h
j.x = g
j.z = l
k.q = j
k.p = h
h.v = b
g.o = h
l.y = b
l.s = b
l.o = g
l.x = j
b.y = e
b.o = g
b.x = n
b.s = l
e.y = b
e.o = g
e.x = n
e.s = l
n.q = h
n.x = g
n.z = l
assert h.v.y.o.o.txt == "h"