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

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

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

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

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

d = A("d")
i = B("i")
f = C("f")
j = D("j")
e = E("e")
a = A("a")

d.r = e
d.q = j
d.y = j
i.z = j
i.y = a
f.t = e
f.u = e
f.v = i
f.z = j
f.q = j
j.w = e
j.v = e
j.q = d
j.p = i
e.r = d
e.z = d
e.v = j
a.r = e
a.q = j
a.y = j
assert f.t.v.q.y.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
f = C("f")
j = D("j")
e = E("e")
a = A("a")

d.r = e
d.q = j
d.y = j
i.z = j
i.y = a
f.t = e
f.u = e
f.v = i
f.z = j
f.q = j
j.w = e
j.v = e
j.q = d
j.p = i
e.r = d
e.z = d
e.v = j
a.r = e
a.q = j
a.y = j
assert f.t.v.q.y.p.z.txt == "j"