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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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