class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: D = None
        self.u: A = None
        self.r: E = None
        self.txt = txt

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

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

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

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

b = A("b")
e = B("e")
m = C("m")
l = D("l")
f = E("f")
a = F("a")

b.s = e
e.y = m
e.x = l
e.u = b
e.r = f
m.r = l
m.v = e
m.z = e
m.q = e
l.q = f
l.s = m
l.v = m
f.s = a
f.w = l
f.u = b
f.y = m
a.p = l
a.o = l
assert a.p.q.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: D = None
        self.u: A = None
        self.r: E = None
        self.txt = txt

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

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

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

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

b = A("b")
e = B("e")
m = C("m")
l = D("l")
f = E("f")
a = F("a")

b.s = e
e.y = m
e.x = l
e.u = b
e.r = f
m.r = l
m.v = e
m.z = e
m.q = e
l.q = f
l.s = m
l.v = m
f.s = a
f.w = l
f.u = b
f.y = m
a.p = l
a.o = l
assert a.p.q.s.o.s.txt == "m"