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

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: D = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

b.o = i
b.r = e
a.o = g
a.q = e
a.t = b
i.x = g
i.z = e
i.y = h
i.o = h
h.q = e
g.r = h
e.p = h
e.u = h
e.y = i
e.w = b
assert e.w.r.u.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: D = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

b.o = i
b.r = e
a.o = g
a.q = e
a.t = b
i.x = g
i.z = e
i.y = h
i.o = h
h.q = e
g.r = h
e.p = h
e.u = h
e.y = i
e.w = b
assert e.w.r.u.q.w.o.txt == "i"