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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: F = None
        self.o: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: F = None
        self.o: F = None
        self.p: B = None
        self.u: A = None
        self.t: A = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
h = C("h")
f = D("f")
g = E("g")
a = F("a")

b.o = f
e.z = g
e.w = a
e.o = b
e.p = b
e.v = b
h.q = g
h.v = a
h.o = a
h.p = e
h.u = b
h.t = b
f.z = b
f.w = b
f.p = e
f.v = h
f.s = g
g.o = a
a.p = g
a.o = e
assert a.p.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: F = None
        self.o: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: F = None
        self.o: F = None
        self.p: B = None
        self.u: A = None
        self.t: A = None
        self.txt = txt

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

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

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

b = A("b")
e = B("e")
h = C("h")
f = D("f")
g = E("g")
a = F("a")

b.o = f
e.z = g
e.w = a
e.o = b
e.p = b
e.v = b
h.q = g
h.v = a
h.o = a
h.p = e
h.u = b
h.t = b
f.z = b
f.w = b
f.p = e
f.v = h
f.s = g
g.o = a
a.p = g
a.o = e
assert a.p.o.o.txt == "e"