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

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

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

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

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

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

f = A("f")
n = B("n")
b = C("b")
j = D("j")
h = E("h")
a = F("a")
c = E("c")

f.w = b
n.v = j
n.o = f
n.w = f
n.x = f
n.z = b
n.u = c
b.u = c
b.y = h
j.x = h
h.o = j
h.w = c
a.y = n
a.z = n
a.s = j
a.p = f
a.u = f
c.o = j
c.w = h
assert h.w.w.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

f = A("f")
n = B("n")
b = C("b")
j = D("j")
h = E("h")
a = F("a")
c = E("c")

f.w = b
n.v = j
n.o = f
n.w = f
n.x = f
n.z = b
n.u = c
b.u = c
b.y = h
j.x = h
h.o = j
h.w = c
a.y = n
a.z = n
a.s = j
a.p = f
a.u = f
c.o = j
c.w = h
assert h.w.w.w.o.txt == "j"