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

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

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

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

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

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

h.y = d
h.s = c
a.x = j
j.y = n
d.t = a
d.s = n
d.x = g
g.r = a
g.w = e
g.t = h
n.t = e
n.s = d
n.x = g
c.y = n
c.s = h
k.y = d
f.y = n
f.s = h
e.x = j
assert f.s.s.s.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

h.y = d
h.s = c
a.x = j
j.y = n
d.t = a
d.s = n
d.x = g
g.r = a
g.w = e
g.t = h
n.t = e
n.s = d
n.x = g
c.y = n
c.s = h
k.y = d
f.y = n
f.s = h
e.x = j
assert f.s.s.s.s.y.txt == "n"