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

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

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

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

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

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

a.u = f
a.q = f
a.z = b
f.z = a
f.t = b
f.o = i
f.w = g
f.s = g
i.q = b
i.y = b
i.t = f
i.s = f
i.x = a
b.o = f
g.y = b
g.v = a
assert i.q.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

a.u = f
a.q = f
a.z = b
f.z = a
f.t = b
f.o = i
f.w = g
f.s = g
i.q = b
i.y = b
i.t = f
i.s = f
i.x = a
b.o = f
g.y = b
g.v = a
assert i.q.o.t.o.txt == "f"