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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: A = None
        self.t: C = None
        self.txt = txt

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

e = A("e")
g = B("g")
c = C("c")
b = D("b")
f = E("f")
m = F("m")
n = D("n")

e.x = b
g.x = m
c.y = g
c.q = f
c.v = m
c.t = b
c.s = b
c.p = e
b.q = g
b.o = f
b.v = f
b.r = m
f.p = g
f.q = e
f.t = c
m.t = e
m.v = c
n.q = g
n.o = f
n.v = f
n.r = m
assert m.t.x.q.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: A = None
        self.t: C = None
        self.txt = txt

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

e = A("e")
g = B("g")
c = C("c")
b = D("b")
f = E("f")
m = F("m")
n = D("n")

e.x = b
g.x = m
c.y = g
c.q = f
c.v = m
c.t = b
c.s = b
c.p = e
b.q = g
b.o = f
b.v = f
b.r = m
f.p = g
f.q = e
f.t = c
m.t = e
m.v = c
n.q = g
n.o = f
n.v = f
n.r = m
assert m.t.x.q.x.v.txt == "c"