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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: F = None
        self.r: E = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.u: E = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

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

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

m = A("m")
d = B("d")
l = C("l")
n = D("n")
c = E("c")
i = F("i")

m.y = i
m.x = l
d.y = c
d.r = c
d.p = i
d.w = l
l.w = d
l.p = d
l.o = d
l.y = n
l.u = c
n.v = c
n.u = c
c.q = i
c.p = n
i.o = c
i.s = n
assert i.s.u.q.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: F = None
        self.r: E = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.u: E = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

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

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

m = A("m")
d = B("d")
l = C("l")
n = D("n")
c = E("c")
i = F("i")

m.y = i
m.x = l
d.y = c
d.r = c
d.p = i
d.w = l
l.w = d
l.p = d
l.o = d
l.y = n
l.u = c
n.v = c
n.u = c
c.q = i
c.p = n
i.o = c
i.s = n
assert i.s.u.q.s.u.txt == "c"