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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: C = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

g = A("g")
j = B("j")
i = C("i")
k = D("k")
a = E("a")
c = D("c")

g.r = k
g.z = i
j.u = a
j.t = k
i.z = a
i.y = a
i.p = a
i.x = c
k.r = j
k.w = i
k.s = i
a.v = g
a.z = g
a.y = i
a.p = j
c.r = j
c.w = i
c.s = i
assert a.y.p.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: C = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

g = A("g")
j = B("j")
i = C("i")
k = D("k")
a = E("a")
c = D("c")

g.r = k
g.z = i
j.u = a
j.t = k
i.z = a
i.y = a
i.p = a
i.x = c
k.r = j
k.w = i
k.s = i
a.v = g
a.z = g
a.y = i
a.p = j
c.r = j
c.w = i
c.s = i
assert a.y.p.y.z.txt == "a"