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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: A = None
        self.q: B = None
        self.r: A = None
        self.txt = txt

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

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

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

i.s = n
i.t = c
i.p = f
c.u = h
c.v = e
c.x = f
h.z = d
h.x = i
h.r = i
h.q = c
n.y = h
n.s = e
d.x = h
e.y = h
e.s = n
f.u = h
f.v = e
f.x = c
j.s = n
j.t = f
j.p = c
assert h.q.x.v.y.x.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: B = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: A = None
        self.q: B = None
        self.r: A = None
        self.txt = txt

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

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

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

i.s = n
i.t = c
i.p = f
c.u = h
c.v = e
c.x = f
h.z = d
h.x = i
h.r = i
h.q = c
n.y = h
n.s = e
d.x = h
e.y = h
e.s = n
f.u = h
f.v = e
f.x = c
j.s = n
j.t = f
j.p = c
assert h.q.x.v.y.x.s.y.txt == "h"