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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.o: E = None
        self.t: A = None
        self.p: A = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.o: E = None
        self.t: A = None
        self.p: A = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.txt = txt

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

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

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

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