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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.s: D = None
        self.v: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.s: B = None
        self.v: C = None
        self.u: A = None
        self.txt = txt

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

g.o = b
m.x = h
l.x = j
h.r = j
h.w = j
h.o = g
j.w = h
j.s = h
j.z = h
j.o = f
j.v = g
b.p = f
b.v = f
b.z = h
b.s = m
b.u = g
f.x = j
assert j.v.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.s: D = None
        self.v: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.s: B = None
        self.v: C = None
        self.u: A = None
        self.txt = txt

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

g.o = b
m.x = h
l.x = j
h.r = j
h.w = j
h.o = g
j.w = h
j.s = h
j.z = h
j.o = f
j.v = g
b.p = f
b.v = f
b.z = h
b.s = m
b.u = g
f.x = j
assert j.v.o.s.txt == "m"