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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.v: F = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: G = None
        self.r: A = None
        self.p: A = None
        self.s: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: H = None
        self.o: D = None
        self.y: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.o: E = None
        self.w: E = None
        self.q: G = None
        self.txt = txt

f = A("f")
n = B("n")
d = C("d")
g = D("g")
a = E("a")
l = F("l")
i = G("i")
m = H("m")

f.p = m
f.t = n
f.x = a
n.t = a
n.o = a
n.v = l
n.u = f
d.t = m
g.x = i
g.z = i
g.r = f
g.p = f
g.s = m
a.p = l
l.o = a
i.s = l
i.p = m
i.o = g
i.y = g
m.z = f
m.v = d
m.o = a
m.w = a
m.q = i
assert f.p.v.t.o.p.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.t: B = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.v: F = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: G = None
        self.r: A = None
        self.p: A = None
        self.s: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: H = None
        self.o: D = None
        self.y: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.o: E = None
        self.w: E = None
        self.q: G = None
        self.txt = txt

f = A("f")
n = B("n")
d = C("d")
g = D("g")
a = E("a")
l = F("l")
i = G("i")
m = H("m")

f.p = m
f.t = n
f.x = a
n.t = a
n.o = a
n.v = l
n.u = f
d.t = m
g.x = i
g.z = i
g.r = f
g.p = f
g.s = m
a.p = l
l.o = a
i.s = l
i.p = m
i.o = g
i.y = g
m.z = f
m.v = d
m.o = a
m.w = a
m.q = i
assert f.p.v.t.o.p.o.p.o.txt == "a"