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

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

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

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

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

e = A("e")
a = B("a")
f = C("f")
d = D("d")
l = E("l")
g = D("g")

e.t = l
e.z = a
e.x = a
e.v = d
e.p = g
a.o = e
f.s = e
f.y = e
f.p = d
d.q = l
d.s = f
d.o = g
l.r = a
g.q = l
g.s = f
g.o = d
assert e.t.r.o.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: B = None
        self.x: B = None
        self.v: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

e = A("e")
a = B("a")
f = C("f")
d = D("d")
l = E("l")
g = D("g")

e.t = l
e.z = a
e.x = a
e.v = d
e.p = g
a.o = e
f.s = e
f.y = e
f.p = d
d.q = l
d.s = f
d.o = g
l.r = a
g.q = l
g.s = f
g.o = d
assert e.t.r.o.v.q.txt == "l"