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

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

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

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

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

a = A("a")
h = B("h")
b = C("b")
k = D("k")
j = E("j")
i = D("i")
e = B("e")
m = E("m")
g = E("g")

a.r = h
a.u = b
a.p = b
h.r = e
b.z = i
b.t = i
b.r = i
b.v = g
k.x = i
k.q = a
k.w = b
j.v = g
j.u = e
i.x = k
i.q = a
i.w = b
e.r = h
m.v = j
m.u = h
g.v = j
g.u = h
assert m.u.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: C = None
        self.p: C = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
b = C("b")
k = D("k")
j = E("j")
i = D("i")
e = B("e")
m = E("m")
g = E("g")

a.r = h
a.u = b
a.p = b
h.r = e
b.z = i
b.t = i
b.r = i
b.v = g
k.x = i
k.q = a
k.w = b
j.v = g
j.u = e
i.x = k
i.q = a
i.w = b
e.r = h
m.v = j
m.u = h
g.v = j
g.u = h
assert m.u.r.r.r.r.r.r.r.r.txt == "h"