class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: E = None
        self.r: E = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: A = None
        self.t: B = None
        self.r: C = None
        self.x: F = None
        self.txt = txt

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

d.v = b
e.y = i
e.u = a
j.o = b
j.w = b
f.u = d
i.v = j
a.z = j
a.t = i
a.r = i
a.u = i
a.v = f
b.s = a
b.x = a
b.w = d
b.t = e
b.r = j
assert a.v.u.v.r.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: E = None
        self.r: E = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: A = None
        self.t: B = None
        self.r: C = None
        self.x: F = None
        self.txt = txt

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

d.v = b
e.y = i
e.u = a
j.o = b
j.w = b
f.u = d
i.v = j
a.z = j
a.t = i
a.r = i
a.u = i
a.v = f
b.s = a
b.x = a
b.w = d
b.t = e
b.r = j
assert a.v.u.v.r.w.w.txt == "d"