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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: G = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: F = None
        self.q: F = None
        self.t: A = None
        self.p: F = None
        self.txt = txt

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

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

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

a.q = f
a.u = l
a.w = l
f.u = d
f.t = d
m.w = d
l.p = f
l.t = i
l.y = m
d.o = a
d.t = a
d.y = j
d.q = j
d.p = j
j.z = f
j.r = b
i.v = a
i.q = b
i.z = d
b.z = f
b.r = j
assert i.v.q.u.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: D = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: G = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: F = None
        self.q: F = None
        self.t: A = None
        self.p: F = None
        self.txt = txt

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

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

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

a.q = f
a.u = l
a.w = l
f.u = d
f.t = d
m.w = d
l.p = f
l.t = i
l.y = m
d.o = a
d.t = a
d.y = j
d.q = j
d.p = j
j.z = f
j.r = b
i.v = a
i.q = b
i.z = d
b.z = f
b.r = j
assert i.v.q.u.o.q.txt == "f"