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

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

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

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

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

j = A("j")
a = B("a")
h = C("h")
n = D("n")
f = E("f")
k = A("k")
g = E("g")

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

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

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

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

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

j = A("j")
a = B("a")
h = C("h")
n = D("n")
f = E("f")
k = A("k")
g = E("g")

j.s = a
j.o = h
j.t = n
a.o = j
h.u = k
h.o = a
h.p = j
n.q = j
n.y = h
n.z = k
n.s = a
n.u = a
f.u = a
f.w = a
f.s = h
f.v = n
f.y = g
k.s = a
k.o = h
k.t = n
g.u = a
g.w = a
g.s = h
g.v = n
g.y = f
assert h.p.t.q.txt == "j"