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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.t: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
j = C("j")
e = D("e")
g = E("g")

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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.t: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
j = C("j")
e = D("e")
g = E("g")

i.w = e
i.r = j
i.t = j
i.q = g
i.o = f
f.z = j
f.x = j
f.s = g
j.o = e
j.y = i
j.u = i
j.q = i
e.q = i
e.t = i
e.o = g
g.q = i
g.y = e
assert g.q.w.o.txt == "g"