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

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

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

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

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

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

h.t = m
h.u = m
h.y = m
h.q = d
h.w = g
g.v = d
g.u = h
m.q = h
m.u = h
m.t = g
d.y = g
i.o = g
n.o = g
assert h.w.u.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.q: D = None
        self.w: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

h.t = m
h.u = m
h.y = m
h.q = d
h.w = g
g.v = d
g.u = h
m.q = h
m.u = h
m.t = g
d.y = g
i.o = g
n.o = g
assert h.w.u.y.t.txt == "g"