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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
e = C("e")
l = D("l")
d = E("d")
n = F("n")

m.u = l
b.r = d
e.x = n
l.s = m
l.q = m
d.o = l
d.z = m
d.v = n
n.o = l
n.r = e
assert d.v.o.s.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
e = C("e")
l = D("l")
d = E("d")
n = F("n")

m.u = l
b.r = d
e.x = n
l.s = m
l.q = m
d.o = l
d.z = m
d.v = n
n.o = l
n.r = e
assert d.v.o.s.u.s.u.txt == "l"