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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.y: C = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

g = A("g")
d = B("d")
a = C("a")
c = D("c")
l = E("l")
m = F("m")

g.o = a
g.x = c
g.r = l
d.z = c
d.q = m
a.x = m
a.y = d
a.q = d
a.u = d
c.q = l
c.v = d
l.v = g
l.s = g
l.w = g
l.t = m
l.q = m
l.z = d
m.v = a
m.r = a
m.y = a
m.t = c
m.q = g
assert m.q.r.t.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.y: C = None
        self.t: D = None
        self.q: A = None
        self.txt = txt

g = A("g")
d = B("d")
a = C("a")
c = D("c")
l = E("l")
m = F("m")

g.o = a
g.x = c
g.r = l
d.z = c
d.q = m
a.x = m
a.y = d
a.q = d
a.u = d
c.q = l
c.v = d
l.v = g
l.s = g
l.w = g
l.t = m
l.q = m
l.z = d
m.v = a
m.r = a
m.y = a
m.t = c
m.q = g
assert m.q.r.t.q.o.txt == "a"