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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: F = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: A = None
        self.v: B = None
        self.w: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.z: D = None
        self.s: A = None
        self.w: E = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

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

a.t = i
f.x = e
f.z = h
n.o = a
n.t = h
b.q = n
b.o = i
b.w = a
e.p = b
i.z = a
i.x = a
i.v = f
i.w = f
i.o = n
h.y = b
h.o = b
h.z = b
h.r = b
h.s = a
h.w = k
h.t = i
k.p = b
assert b.o.v.z.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: F = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: A = None
        self.v: B = None
        self.w: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.z: D = None
        self.s: A = None
        self.w: E = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

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

a.t = i
f.x = e
f.z = h
n.o = a
n.t = h
b.q = n
b.o = i
b.w = a
e.p = b
i.z = a
i.x = a
i.v = f
i.w = f
i.o = n
h.y = b
h.o = b
h.z = b
h.r = b
h.s = a
h.w = k
h.t = i
k.p = b
assert b.o.v.z.w.p.txt == "b"