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

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

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

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

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

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

m = A("m")
c = B("c")
f = C("f")
l = D("l")
h = E("h")
j = F("j")

m.o = j
m.t = f
c.r = h
f.w = m
f.o = m
f.u = m
f.v = j
l.x = c
l.s = f
l.o = f
l.w = m
l.q = j
h.v = m
h.x = l
h.t = f
j.y = c
assert m.o.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

m = A("m")
c = B("c")
f = C("f")
l = D("l")
h = E("h")
j = F("j")

m.o = j
m.t = f
c.r = h
f.w = m
f.o = m
f.u = m
f.v = j
l.x = c
l.s = f
l.o = f
l.w = m
l.q = j
h.v = m
h.x = l
h.t = f
j.y = c
assert m.o.y.r.txt == "h"