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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: F = None
        self.r: E = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: F = None
        self.r: E = None
        self.p: A = None
        self.txt = txt

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

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

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

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

l.t = h
l.v = h
l.y = j
l.o = j
f.w = h
j.s = f
j.y = m
j.r = e
j.p = l
h.w = m
h.p = e
e.t = l
m.x = l
m.w = l
m.o = f
assert j.s.w.w.x.txt == "l"