class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: C = None
        self.y: G = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: E = None
        self.txt = txt

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

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

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

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

j.p = n
j.z = f
j.y = g
j.t = h
j.u = h
n.r = g
f.r = e
f.v = k
f.q = h
f.p = a
a.p = f
a.s = k
k.z = a
k.y = f
k.s = e
h.u = g
g.p = k
e.p = k
assert f.p.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: C = None
        self.y: G = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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