class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.r: C = None
        self.q: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
f = D("f")
e = E("e")
b = F("b")

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

i = A("i")
g = B("g")
m = C("m")
f = D("f")
e = E("e")
b = F("b")

i.o = f
i.q = f
i.t = g
i.r = m
g.w = f
g.q = f
g.s = m
m.v = e
f.t = e
f.z = e
f.u = i
e.p = g
e.z = g
e.w = b
e.o = b
b.v = g
assert f.t.o.v.q.txt == "f"