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

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

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

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

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

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

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

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

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

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

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

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

h.o = n
h.y = n
h.x = k
h.u = c
h.v = i
c.x = g
i.x = h
i.t = h
i.v = k
n.z = i
n.p = h
n.w = h
n.s = h
n.o = k
k.z = g
k.s = g
k.y = g
k.w = h
k.r = i
g.x = c
assert g.x.x.x.x.txt == "g"