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

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

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

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

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

a = A("a")
k = B("k")
g = C("g")
h = D("h")
m = E("m")
n = D("n")
j = B("j")
l = A("l")

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

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

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

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

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

a = A("a")
k = B("k")
g = C("g")
h = D("h")
m = E("m")
n = D("n")
j = B("j")
l = A("l")

a.x = n
a.y = n
a.v = g
a.q = g
k.o = m
k.p = g
k.w = g
k.x = h
g.o = k
g.s = n
g.q = m
g.z = j
h.o = a
m.q = j
m.x = g
n.o = a
j.o = m
j.p = g
j.w = g
j.x = n
l.x = h
l.y = n
l.v = g
l.q = g
assert j.x.o.x.o.x.o.q.q.txt == "m"