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

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

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

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

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

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

i = A("i")
m = B("m")
a = C("a")
e = D("e")
b = E("b")
g = F("g")

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

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

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

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

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

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

i = A("i")
m = B("m")
a = C("a")
e = D("e")
b = E("b")
g = F("g")

i.x = e
i.t = b
m.s = a
m.v = a
m.t = a
m.q = i
m.r = e
m.y = g
a.o = g
a.y = m
a.s = e
a.p = i
e.t = m
e.y = m
e.x = a
e.w = i
e.r = b
b.w = g
b.q = m
b.p = e
g.v = m
assert g.v.v.o.v.txt == "m"