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

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

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

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

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

j = A("j")
f = B("f")
b = C("b")
a = D("a")
m = E("m")
l = A("l")
h = E("h")

j.x = a
j.z = f
j.y = l
f.r = j
b.r = a
b.s = f
b.y = f
a.t = h
a.q = h
a.x = b
a.o = f
a.w = l
m.t = b
m.p = l
m.r = a
m.z = a
l.x = a
l.z = f
l.y = j
h.t = b
h.p = l
h.r = a
h.z = a
assert f.r.z.r.z.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: B = None
        self.y: A = None
        self.txt = txt

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

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

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

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

j = A("j")
f = B("f")
b = C("b")
a = D("a")
m = E("m")
l = A("l")
h = E("h")

j.x = a
j.z = f
j.y = l
f.r = j
b.r = a
b.s = f
b.y = f
a.t = h
a.q = h
a.x = b
a.o = f
a.w = l
m.t = b
m.p = l
m.r = a
m.z = a
l.x = a
l.z = f
l.y = j
h.t = b
h.p = l
h.r = a
h.z = a
assert f.r.z.r.z.r.z.r.txt == "j"