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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: F = None
        self.y: D = None
        self.v: F = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
n = C("n")
f = D("f")
b = E("b")
g = F("g")
k = G("k")

j.q = n
j.z = k
j.s = f
j.p = f
j.u = f
c.o = k
n.z = f
n.w = k
n.x = b
f.o = k
b.q = n
b.w = g
b.v = g
b.y = f
g.t = c
g.p = f
g.v = k
k.z = g
assert c.o.z.v.z.t.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: G = None
        self.s: D = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: F = None
        self.y: D = None
        self.v: F = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
n = C("n")
f = D("f")
b = E("b")
g = F("g")
k = G("k")

j.q = n
j.z = k
j.s = f
j.p = f
j.u = f
c.o = k
n.z = f
n.w = k
n.x = b
f.o = k
b.q = n
b.w = g
b.v = g
b.y = f
g.t = c
g.p = f
g.v = k
k.z = g
assert c.o.z.v.z.t.o.z.txt == "g"