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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

g = A("g")
m = B("m")
k = C("k")
e = D("e")
i = E("i")

g.o = i
g.t = i
g.r = m
g.y = m
m.v = g
m.s = e
m.o = k
m.u = k
m.q = i
k.w = m
k.t = m
k.x = m
e.v = g
e.t = g
e.q = i
e.z = i
e.x = m
i.x = g
assert e.x.u.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: B = None
        self.y: B = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

g = A("g")
m = B("m")
k = C("k")
e = D("e")
i = E("i")

g.o = i
g.t = i
g.r = m
g.y = m
m.v = g
m.s = e
m.o = k
m.u = k
m.q = i
k.w = m
k.t = m
k.x = m
e.v = g
e.t = g
e.q = i
e.z = i
e.x = m
i.x = g
assert e.x.u.x.q.txt == "i"