class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
i = C("i")
d = D("d")
h = E("h")
a = F("a")
j = A("j")

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
i = C("i")
d = D("d")
h = E("h")
a = F("a")
j = A("j")

k.w = j
k.p = n
k.s = n
n.r = a
n.u = i
i.z = a
i.y = j
i.v = h
d.t = h
d.p = i
h.q = j
h.z = a
a.u = k
a.p = d
j.w = k
j.p = n
j.s = n
assert a.u.s.r.p.t.txt == "h"