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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
k = C("k")
g = D("g")
c = E("c")
i = F("i")

m.z = g
m.r = i
b.u = k
b.t = g
k.v = m
g.o = b
g.x = m
c.s = b
c.z = b
c.q = i
c.u = k
i.s = c
i.u = c
i.o = b
assert g.x.r.s.s.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
k = C("k")
g = D("g")
c = E("c")
i = F("i")

m.z = g
m.r = i
b.u = k
b.t = g
k.v = m
g.o = b
g.x = m
c.s = b
c.z = b
c.q = i
c.u = k
i.s = c
i.u = c
i.o = b
assert g.x.r.s.s.u.v.txt == "m"