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

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

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

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

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

i = A("i")
n = B("n")
b = C("b")
d = D("d")
k = E("k")
c = B("c")
j = B("j")
m = D("m")
h = C("h")

i.x = k
i.t = k
n.r = c
n.z = c
n.s = i
n.w = i
n.y = d
b.x = c
b.p = i
d.s = j
d.r = m
d.y = m
d.z = n
d.x = b
k.s = h
c.r = n
c.s = i
c.w = i
c.z = j
c.y = m
j.r = n
j.z = n
j.s = i
j.w = i
j.y = d
m.s = c
m.r = d
m.y = d
m.z = j
m.x = h
h.x = n
h.p = i
assert k.s.x.z.r.y.s.r.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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

i = A("i")
n = B("n")
b = C("b")
d = D("d")
k = E("k")
c = B("c")
j = B("j")
m = D("m")
h = C("h")

i.x = k
i.t = k
n.r = c
n.z = c
n.s = i
n.w = i
n.y = d
b.x = c
b.p = i
d.s = j
d.r = m
d.y = m
d.z = n
d.x = b
k.s = h
c.r = n
c.s = i
c.w = i
c.z = j
c.y = m
j.r = n
j.z = n
j.s = i
j.w = i
j.y = d
m.s = c
m.r = d
m.y = d
m.z = j
m.x = h
h.x = n
h.p = i
assert k.s.x.z.r.y.s.r.y.s.txt == "j"