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

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

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

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

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

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

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

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

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

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

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

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

f.w = j
f.q = l
f.y = d
l.y = h
l.r = a
l.w = j
l.s = d
j.z = k
k.q = j
h.x = d
h.p = k
h.q = k
h.z = k
a.y = h
a.r = l
a.w = j
a.s = d
d.w = j
d.q = a
d.y = f
assert f.y.y.y.w.z.q.txt == "j"