class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: B = None
        self.z: C = None
        self.y: D = None
        self.w: F = None
        self.x: D = None
        self.v: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: E = None
        self.x: C = None
        self.z: C = None
        self.v: G = None
        self.t: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: D = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: E = None
        self.x: C = None
        self.z: C = None
        self.v: G = None
        self.t: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: D = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

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

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