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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: E = None
        self.s: F = None
        self.u: D = None
        self.q: G = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: E = None
        self.v: F = None
        self.o: B = None
        self.q: G = None
        self.r: E = None
        self.s: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.w: G = None
        self.t: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: E = None
        self.s: F = None
        self.u: D = None
        self.q: G = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: E = None
        self.v: F = None
        self.o: B = None
        self.q: G = None
        self.r: E = None
        self.s: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.w: G = None
        self.t: C = None
        self.txt = txt

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

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