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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: C = None
        self.p: B = None
        self.u: G = None
        self.o: E = None
        self.q: A = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: C = None
        self.p: B = None
        self.u: G = None
        self.o: E = None
        self.q: A = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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