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

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

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

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

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

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

j.z = f
j.s = k
j.t = k
j.r = d
k.x = j
k.z = f
k.r = c
g.q = h
h.x = c
h.s = k
f.y = j
f.z = h
a.z = f
a.s = k
a.t = c
a.r = d
c.x = j
c.z = f
c.r = k
d.q = h
assert f.y.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.s: B = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

j.z = f
j.s = k
j.t = k
j.r = d
k.x = j
k.z = f
k.r = c
g.q = h
h.x = c
h.s = k
f.y = j
f.z = h
a.z = f
a.s = k
a.t = c
a.r = d
c.x = j
c.z = f
c.r = k
d.q = h
assert f.y.z.z.txt == "h"