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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: C = None
        self.t: D = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: C = None
        self.r: E = None
        self.s: C = None
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: E = None
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: C = None
        self.t: D = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: C = None
        self.r: E = None
        self.s: C = None
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: E = None
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

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

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