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

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

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

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

m = A("m")
j = B("j")
h = C("h")
e = D("e")
c = B("c")
n = C("n")
a = B("a")
k = A("k")
l = A("l")

m.q = e
m.r = j
m.w = n
j.q = m
h.w = k
h.o = c
h.z = n
e.s = h
e.v = m
c.q = k
n.w = k
n.o = a
n.z = h
a.q = k
k.q = e
k.r = a
k.w = h
l.q = e
l.r = a
l.w = h
assert k.r.q.q.v.r.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
h = C("h")
e = D("e")
c = B("c")
n = C("n")
a = B("a")
k = A("k")
l = A("l")

m.q = e
m.r = j
m.w = n
j.q = m
h.w = k
h.o = c
h.z = n
e.s = h
e.v = m
c.q = k
n.w = k
n.o = a
n.z = h
a.q = k
k.q = e
k.r = a
k.w = h
l.q = e
l.r = a
l.w = h
assert k.r.q.q.v.r.q.q.txt == "e"