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

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

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

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

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

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

n.s = i
f.u = h
f.s = j
h.p = k
h.r = e
i.u = b
i.x = e
j.y = e
j.p = h
j.t = h
e.s = b
b.u = i
b.x = e
k.y = n
k.p = h
k.t = h
assert n.s.u.u.u.u.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

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

n.s = i
f.u = h
f.s = j
h.p = k
h.r = e
i.u = b
i.x = e
j.y = e
j.p = h
j.t = h
e.s = b
b.u = i
b.x = e
k.y = n
k.p = h
k.t = h
assert n.s.u.u.u.u.x.s.txt == "b"