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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: B = None
        self.t: G = None
        self.s: G = None
        self.p: E = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: C = None
        self.q: G = None
        self.s: A = None
        self.u: C = None
        self.y: C = None
        self.txt = txt

f = A("f")
k = B("k")
d = C("d")
m = D("m")
j = E("j")
n = F("n")
a = G("a")
e = G("e")

f.p = n
k.v = n
d.y = k
d.r = n
m.q = a
m.z = j
j.y = e
n.u = e
n.t = e
n.s = e
n.x = k
n.p = j
n.y = a
a.t = j
a.p = d
a.u = d
a.y = d
a.q = e
a.s = f
e.t = j
e.p = d
e.u = d
e.y = d
e.q = a
e.s = f
assert f.p.t.s.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: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: B = None
        self.t: G = None
        self.s: G = None
        self.p: E = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: C = None
        self.q: G = None
        self.s: A = None
        self.u: C = None
        self.y: C = None
        self.txt = txt

f = A("f")
k = B("k")
d = C("d")
m = D("m")
j = E("j")
n = F("n")
a = G("a")
e = G("e")

f.p = n
k.v = n
d.y = k
d.r = n
m.q = a
m.z = j
j.y = e
n.u = e
n.t = e
n.s = e
n.x = k
n.p = j
n.y = a
a.t = j
a.p = d
a.u = d
a.y = d
a.q = e
a.s = f
e.t = j
e.p = d
e.u = d
e.y = d
e.q = a
e.s = f
assert f.p.t.s.p.txt == "n"