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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.u: F = None
        self.txt = txt

n = A("n")
l = B("l")
i = C("i")
h = D("h")
j = E("j")
e = F("e")
f = G("f")
c = B("c")
a = C("a")
m = G("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.u: F = None
        self.txt = txt

n = A("n")
l = B("l")
i = C("i")
h = D("h")
j = E("j")
e = F("e")
f = G("f")
c = B("c")
a = C("a")
m = G("m")

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