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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.z: E = None
        self.v: B = None
        self.q: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.z: E = None
        self.v: B = None
        self.q: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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