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

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

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

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

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

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

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

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

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

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

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

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

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

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

k.r = m
k.v = m
m.p = n
m.q = b
b.x = i
b.u = i
i.z = l
i.r = l
n.p = b
n.o = l
n.y = m
n.x = m
l.s = b
l.y = i
l.u = k
assert m.q.u.z.y.txt == "i"