class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: C = None
        self.x: C = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

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