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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: C = None
        self.y: E = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: C = None
        self.y: E = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: F = None
        self.txt = txt

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

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

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

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

d.w = e
d.t = f
k.p = f
k.o = e
k.v = e
k.y = b
e.u = c
f.z = k
f.o = n
b.w = k
b.p = k
b.t = k
b.o = k
b.x = k
b.q = c
b.r = c
n.v = b
c.w = e
c.q = d
assert d.t.z.v.u.txt == "c"