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

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

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

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

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

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

f.v = g
f.w = g
f.q = l
f.r = d
n.p = d
k.p = g
k.t = g
k.z = d
k.v = d
d.q = f
d.y = l
d.z = j
d.w = g
d.u = k
g.x = k
g.o = k
g.z = k
g.r = f
g.y = d
j.p = d
l.v = g
l.w = g
l.q = f
l.r = d
assert d.y.w.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: A = None
        self.w: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

f.v = g
f.w = g
f.q = l
f.r = d
n.p = d
k.p = g
k.t = g
k.z = d
k.v = d
d.q = f
d.y = l
d.z = j
d.w = g
d.u = k
g.x = k
g.o = k
g.z = k
g.r = f
g.y = d
j.p = d
l.v = g
l.w = g
l.q = f
l.r = d
assert d.y.w.r.q.txt == "l"