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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: D = None
        self.v: A = None
        self.x: D = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: F = None
        self.z: D = None
        self.y: D = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
k = C("k")
b = D("b")
l = E("l")
n = F("n")

m.q = n
m.o = b
m.w = l
i.w = m
i.v = m
i.z = m
i.q = b
i.x = b
k.s = n
k.t = n
k.z = b
k.y = b
b.s = n
b.r = k
l.o = n
n.w = l
assert l.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: D = None
        self.v: A = None
        self.x: D = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: F = None
        self.z: D = None
        self.y: D = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
k = C("k")
b = D("b")
l = E("l")
n = F("n")

m.q = n
m.o = b
m.w = l
i.w = m
i.v = m
i.z = m
i.q = b
i.x = b
k.s = n
k.t = n
k.z = b
k.y = b
b.s = n
b.r = k
l.o = n
n.w = l
assert l.o.w.o.txt == "n"