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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: F = None
        self.x: A = None
        self.txt = txt

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

j = A("j")
i = B("i")
l = C("l")
m = D("m")
e = E("e")
n = F("n")
g = C("g")

j.w = n
j.z = g
j.s = e
i.w = l
i.q = n
i.r = e
i.s = g
l.y = m
l.w = e
m.y = n
m.q = i
m.z = i
e.q = n
e.s = n
e.x = j
n.y = m
n.r = m
n.s = j
n.q = i
g.y = m
g.w = e
assert l.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: C = None
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: F = None
        self.x: A = None
        self.txt = txt

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

j = A("j")
i = B("i")
l = C("l")
m = D("m")
e = E("e")
n = F("n")
g = C("g")

j.w = n
j.z = g
j.s = e
i.w = l
i.q = n
i.r = e
i.s = g
l.y = m
l.w = e
m.y = n
m.q = i
m.z = i
e.q = n
e.s = n
e.x = j
n.y = m
n.r = m
n.s = j
n.q = i
g.y = m
g.w = e
assert l.y.q.q.txt == "n"