class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: D = None
        self.r: E = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.y: E = None
        self.q: F = None
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

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

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

b.u = j
b.q = j
b.v = e
b.r = f
b.s = f
j.v = b
j.x = b
j.z = b
j.u = b
j.y = f
j.q = k
a.x = e
e.v = a
e.y = b
e.p = b
e.s = j
f.v = d
k.u = b
k.w = b
k.v = b
k.s = a
d.z = f
d.v = b
assert f.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: D = None
        self.r: E = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.y: E = None
        self.q: F = None
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

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

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

b.u = j
b.q = j
b.v = e
b.r = f
b.s = f
j.v = b
j.x = b
j.z = b
j.u = b
j.y = f
j.q = k
a.x = e
e.v = a
e.y = b
e.p = b
e.s = j
f.v = d
k.u = b
k.w = b
k.v = b
k.s = a
d.z = f
d.v = b
assert f.v.z.v.txt == "d"