class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.w: F = None
        self.z: E = None
        self.u: F = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

m = A("m")
e = B("e")
g = C("g")
j = D("j")
a = E("a")
d = F("d")

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

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

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

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

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

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

m = A("m")
e = B("e")
g = C("g")
j = D("j")
a = E("a")
d = F("d")

m.r = j
m.o = j
m.w = d
m.u = d
m.z = a
m.q = e
e.o = a
e.v = d
e.q = d
e.w = j
g.y = e
g.p = e
g.s = e
g.v = d
g.z = j
g.q = a
j.w = m
j.o = m
j.u = g
a.v = m
d.v = m
d.x = m
d.y = e
assert g.q.v.z.v.txt == "m"