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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

b = A("b")
h = B("h")
g = C("g")
j = D("j")
n = E("n")
c = D("c")
d = E("d")

b.t = h
b.o = h
b.y = h
b.z = g
b.w = j
h.s = d
h.o = b
h.t = b
g.w = b
g.p = j
j.w = d
n.z = d
c.w = d
d.z = n
assert j.w.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: C = None
        self.o: B = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

b = A("b")
h = B("h")
g = C("g")
j = D("j")
n = E("n")
c = D("c")
d = E("d")

b.t = h
b.o = h
b.y = h
b.z = g
b.w = j
h.s = d
h.o = b
h.t = b
g.w = b
g.p = j
j.w = d
n.z = d
c.w = d
d.z = n
assert j.w.z.z.z.txt == "n"