class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: D = None
        self.r: G = None
        self.txt = txt

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

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

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

n.o = i
f.u = e
f.s = i
f.z = i
f.x = i
i.p = d
e.p = f
h.w = d
h.o = e
h.r = c
d.s = i
d.x = e
d.r = n
d.p = f
l.y = c
l.r = d
l.x = d
l.p = e
c.y = l
c.r = d
c.x = d
c.p = e
assert h.w.p.u.p.u.p.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: D = None
        self.r: G = None
        self.txt = txt

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

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

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

n.o = i
f.u = e
f.s = i
f.z = i
f.x = i
i.p = d
e.p = f
h.w = d
h.o = e
h.r = c
d.s = i
d.x = e
d.r = n
d.p = f
l.y = c
l.r = d
l.x = d
l.p = e
c.y = l
c.r = d
c.x = d
c.p = e
assert h.w.p.u.p.u.p.z.p.txt == "d"