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

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

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

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

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

g = A("g")
f = B("f")
n = C("n")
i = D("i")
h = E("h")

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

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

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

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

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

g = A("g")
f = B("f")
n = C("n")
i = D("i")
h = E("h")

g.o = n
g.w = i
g.r = i
g.u = f
f.p = i
f.z = i
f.q = g
f.u = h
n.p = i
n.z = i
n.q = f
n.s = f
i.u = h
i.y = h
i.t = g
h.t = n
h.x = g
h.z = i
assert f.z.u.t.txt == "n"