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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: D = None
        self.q: C = None
        self.txt = txt

h = A("h")
b = B("b")
a = C("a")
f = D("f")
k = E("k")
g = D("g")
c = C("c")
d = E("d")

h.o = g
h.s = b
b.t = c
b.u = c
b.o = a
b.p = k
a.u = f
f.z = c
f.w = b
f.s = g
k.v = d
k.x = a
k.r = g
k.q = c
g.z = a
g.w = b
g.s = f
c.u = f
d.v = k
d.x = a
d.r = g
d.q = c
assert f.s.s.s.z.u.z.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: D = None
        self.q: C = None
        self.txt = txt

h = A("h")
b = B("b")
a = C("a")
f = D("f")
k = E("k")
g = D("g")
c = C("c")
d = E("d")

h.o = g
h.s = b
b.t = c
b.u = c
b.o = a
b.p = k
a.u = f
f.z = c
f.w = b
f.s = g
k.v = d
k.x = a
k.r = g
k.q = c
g.z = a
g.w = b
g.s = f
c.u = f
d.v = k
d.x = a
d.r = g
d.q = c
assert f.s.s.s.z.u.z.u.s.txt == "g"