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

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

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

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

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

i = A("i")
e = B("e")
b = C("b")
n = D("n")
g = E("g")

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

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

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

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

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

i = A("i")
e = B("e")
b = C("b")
n = D("n")
g = E("g")

i.o = g
i.z = e
e.r = n
e.y = n
e.q = i
b.o = n
b.w = g
n.s = e
g.r = e
g.o = e
g.t = e
g.x = n
g.v = b
assert g.t.q.o.txt == "g"