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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: F = None
        self.w: E = None
        self.z: E = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: B = None
        self.u: D = None
        self.q: E = None
        self.t: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

j = A("j")
h = B("h")
n = C("n")
m = D("m")
g = E("g")
d = F("d")

j.r = m
j.y = h
j.q = d
h.v = g
h.w = g
h.z = g
h.r = d
h.s = n
n.w = j
n.v = h
n.u = m
n.q = g
n.t = g
m.z = h
m.p = n
g.y = n
d.y = g
d.t = g
d.s = m
assert n.u.z.w.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: B = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: F = None
        self.w: E = None
        self.z: E = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: B = None
        self.u: D = None
        self.q: E = None
        self.t: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

j = A("j")
h = B("h")
n = C("n")
m = D("m")
g = E("g")
d = F("d")

j.r = m
j.y = h
j.q = d
h.v = g
h.w = g
h.z = g
h.r = d
h.s = n
n.w = j
n.v = h
n.u = m
n.q = g
n.t = g
m.z = h
m.p = n
g.y = n
d.y = g
d.t = g
d.s = m
assert n.u.z.w.y.u.txt == "m"