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

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

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

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

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

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

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

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

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

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

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

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

f.x = k
f.r = a
f.p = n
f.y = l
k.s = b
k.y = b
k.w = a
k.x = d
e.t = d
e.q = d
e.y = b
e.x = h
j.t = e
d.r = j
d.x = a
n.t = e
b.s = k
b.y = k
b.w = e
b.x = d
h.t = e
l.x = b
l.r = a
l.p = j
l.y = f
a.t = d
a.q = d
a.y = k
a.x = j
assert n.t.x.t.q.r.t.y.x.r.t.txt == "e"