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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: A = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.q: F = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: A = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.q: F = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

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

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

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