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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: F = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: F = None
        self.s: E = None
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

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

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

f.o = i
f.v = h
f.q = j
f.w = c
i.o = b
i.z = c
j.q = c
j.w = b
j.u = i
j.v = i
c.x = i
c.y = i
c.v = b
c.s = h
c.o = j
h.v = j
h.t = f
h.p = f
b.u = h
b.r = c
assert f.w.o.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: E = None
        self.q: C = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: F = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: F = None
        self.s: E = None
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

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

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

f.o = i
f.v = h
f.q = j
f.w = c
i.o = b
i.z = c
j.q = c
j.w = b
j.u = i
j.v = i
c.x = i
c.y = i
c.v = b
c.s = h
c.o = j
h.v = j
h.t = f
h.p = f
b.u = h
b.r = c
assert f.w.o.q.s.txt == "h"