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

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

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

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

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

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

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

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

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

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

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

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

a.x = d
a.r = d
l.p = j
l.r = j
l.u = f
l.v = d
f.t = j
f.o = a
f.q = d
d.s = m
m.z = a
g.p = l
g.r = j
g.u = f
g.v = d
j.p = g
j.r = g
j.u = f
j.v = d
assert g.r.r.p.u.q.s.z.txt == "a"