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

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

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

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

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

i = A("i")
c = B("c")
b = C("b")
m = D("m")
k = E("k")
d = B("d")
g = E("g")
f = A("f")

i.y = g
i.x = f
i.z = f
i.s = m
i.t = k
c.r = i
c.v = g
b.s = m
b.r = i
m.x = d
k.s = b
k.u = b
k.v = g
k.t = d
d.r = f
d.v = k
g.s = b
g.u = b
g.v = k
g.t = c
f.y = k
f.x = i
f.z = i
f.s = m
f.t = g
assert k.v.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: A = None
        self.s: D = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
b = C("b")
m = D("m")
k = E("k")
d = B("d")
g = E("g")
f = A("f")

i.y = g
i.x = f
i.z = f
i.s = m
i.t = k
c.r = i
c.v = g
b.s = m
b.r = i
m.x = d
k.s = b
k.u = b
k.v = g
k.t = d
d.r = f
d.v = k
g.s = b
g.u = b
g.v = k
g.t = c
f.y = k
f.x = i
f.z = i
f.s = m
f.t = g
assert k.v.t.v.t.txt == "c"