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

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

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

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

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

i = A("i")
n = B("n")
g = C("g")
a = D("a")
f = E("f")

i.z = n
i.y = g
n.r = g
n.q = a
n.t = a
n.s = i
g.s = a
g.u = n
a.v = i
f.u = a
f.z = i
assert n.r.u.t.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

i = A("i")
n = B("n")
g = C("g")
a = D("a")
f = E("f")

i.z = n
i.y = g
n.r = g
n.q = a
n.t = a
n.s = i
g.s = a
g.u = n
a.v = i
f.u = a
f.z = i
assert n.r.u.t.v.y.txt == "g"