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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.u: B = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
e = C("e")
j = D("j")
h = E("h")
f = D("f")
l = A("l")
k = C("k")

m.r = l
m.p = j
g.q = e
g.r = e
g.y = j
g.z = m
g.v = k
e.r = f
e.z = h
e.u = g
j.s = k
j.w = g
j.o = g
j.z = l
j.v = m
h.r = k
h.v = j
h.p = g
f.s = k
f.w = g
f.o = g
f.z = m
f.v = l
l.r = m
l.p = j
k.r = j
k.z = h
k.u = g
assert g.q.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.u: B = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
e = C("e")
j = D("j")
h = E("h")
f = D("f")
l = A("l")
k = C("k")

m.r = l
m.p = j
g.q = e
g.r = e
g.y = j
g.z = m
g.v = k
e.r = f
e.z = h
e.u = g
j.s = k
j.w = g
j.o = g
j.z = l
j.v = m
h.r = k
h.v = j
h.p = g
f.s = k
f.w = g
f.o = g
f.z = m
f.v = l
l.r = m
l.p = j
k.r = j
k.z = h
k.u = g
assert g.q.r.v.txt == "l"