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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.p: D = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
g = D("g")
c = E("c")
k = B("k")
l = A("l")

d.q = n
d.v = g
d.s = c
d.o = c
j.r = d
j.v = k
n.p = l
g.z = l
c.w = g
c.r = g
c.p = g
k.r = l
k.v = j
l.q = n
l.v = g
l.s = c
l.o = c
assert d.q.p.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: D = None
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.p: D = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
g = D("g")
c = E("c")
k = B("k")
l = A("l")

d.q = n
d.v = g
d.s = c
d.o = c
j.r = d
j.v = k
n.p = l
g.z = l
c.w = g
c.r = g
c.p = g
k.r = l
k.v = j
l.q = n
l.v = g
l.s = c
l.o = c
assert d.q.p.v.z.txt == "l"