class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: E = None
        self.s: B = None
        self.w: D = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
l = C("l")
a = D("a")
i = E("i")
m = F("m")

b.t = a
b.w = a
b.r = i
b.s = n
b.x = m
n.y = a
n.z = a
n.r = l
l.o = b
l.y = i
a.s = m
a.w = i
i.y = m
i.q = l
m.z = i
m.v = a
m.o = l
m.q = b
assert a.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: E = None
        self.s: B = None
        self.w: D = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
l = C("l")
a = D("a")
i = E("i")
m = F("m")

b.t = a
b.w = a
b.r = i
b.s = n
b.x = m
n.y = a
n.z = a
n.r = l
l.o = b
l.y = i
a.s = m
a.w = i
i.y = m
i.q = l
m.z = i
m.v = a
m.o = l
m.q = b
assert a.s.o.o.txt == "b"