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

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

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

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

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

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

a = A("a")
n = B("n")
j = C("j")
m = D("m")
i = E("i")
k = F("k")
e = D("e")

a.u = j
a.w = k
n.w = a
n.o = m
j.y = i
m.v = i
m.q = i
m.r = k
m.u = k
m.w = a
i.o = n
i.w = n
k.o = a
e.v = i
e.q = i
e.r = k
e.u = k
e.w = a
assert j.y.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

a = A("a")
n = B("n")
j = C("j")
m = D("m")
i = E("i")
k = F("k")
e = D("e")

a.u = j
a.w = k
n.w = a
n.o = m
j.y = i
m.v = i
m.q = i
m.r = k
m.u = k
m.w = a
i.o = n
i.w = n
k.o = a
e.v = i
e.q = i
e.r = k
e.u = k
e.w = a
assert j.y.w.o.txt == "m"