class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: D = None
        self.x: E = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: A = None
        self.w: D = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
k = C("k")
g = D("g")
m = E("m")
f = F("f")
l = D("l")

i.w = j
i.s = l
i.x = m
i.u = f
j.u = g
j.y = i
j.w = l
k.u = j
g.q = l
g.r = f
m.w = i
f.y = m
l.q = g
l.r = f
assert m.w.w.w.r.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: D = None
        self.x: E = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: A = None
        self.w: D = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
k = C("k")
g = D("g")
m = E("m")
f = F("f")
l = D("l")

i.w = j
i.s = l
i.x = m
i.u = f
j.u = g
j.y = i
j.w = l
k.u = j
g.q = l
g.r = f
m.w = i
f.y = m
l.q = g
l.r = f
assert m.w.w.w.r.y.w.txt == "i"