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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: D = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: C = None
        self.s: B = None
        self.v: E = None
        self.r: C = None
        self.txt = txt

j = A("j")
c = B("c")
e = C("e")
d = D("d")
g = E("g")
l = E("l")

j.z = c
j.r = c
c.v = g
e.u = d
e.w = d
e.v = g
d.t = c
d.s = c
d.z = j
g.x = j
g.q = e
g.r = e
g.s = c
g.v = l
l.x = j
l.q = e
l.r = e
l.s = c
l.v = g
assert l.x.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: D = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: C = None
        self.s: B = None
        self.v: E = None
        self.r: C = None
        self.txt = txt

j = A("j")
c = B("c")
e = C("e")
d = D("d")
g = E("g")
l = E("l")

j.z = c
j.r = c
c.v = g
e.u = d
e.w = d
e.v = g
d.t = c
d.s = c
d.z = j
g.x = j
g.q = e
g.r = e
g.s = c
g.v = l
l.x = j
l.q = e
l.r = e
l.s = c
l.v = g
assert l.x.r.v.txt == "g"