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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: B = None
        self.r: F = None
        self.q: A = None
        self.w: F = None
        self.o: A = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
m = C("m")
a = D("a")
e = E("e")
f = F("f")

j.v = a
l.o = m
l.w = e
m.x = f
m.r = f
m.w = f
m.v = l
m.q = j
m.o = j
a.q = m
a.x = l
e.w = f
e.z = f
e.r = m
e.q = m
f.q = l
assert j.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: B = None
        self.r: F = None
        self.q: A = None
        self.w: F = None
        self.o: A = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
m = C("m")
a = D("a")
e = E("e")
f = F("f")

j.v = a
l.o = m
l.w = e
m.x = f
m.r = f
m.w = f
m.v = l
m.q = j
m.o = j
a.q = m
a.x = l
e.w = f
e.z = f
e.r = m
e.q = m
f.q = l
assert j.v.q.v.txt == "l"