class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: E = None
        self.v: E = None
        self.z: A = None
        self.u: F = None
        self.r: E = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
c = C("c")
m = D("m")
l = E("l")
g = F("g")

j.w = c
n.x = m
n.t = l
n.v = l
n.r = l
n.z = j
n.u = g
c.x = j
c.q = g
c.r = l
m.z = g
m.x = n
l.p = m
l.s = j
l.o = g
g.q = m
g.o = m
g.r = n
assert j.w.q.o.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: E = None
        self.v: E = None
        self.z: A = None
        self.u: F = None
        self.r: E = None
        self.txt = txt

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

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

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

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

j = A("j")
n = B("n")
c = C("c")
m = D("m")
l = E("l")
g = F("g")

j.w = c
n.x = m
n.t = l
n.v = l
n.r = l
n.z = j
n.u = g
c.x = j
c.q = g
c.r = l
m.z = g
m.x = n
l.p = m
l.s = j
l.o = g
g.q = m
g.o = m
g.r = n
assert j.w.q.o.z.q.txt == "m"