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

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

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

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

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

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

j = A("j")
n = B("n")
f = C("f")
h = D("h")
i = E("i")
a = F("a")
m = C("m")

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

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

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

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

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

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

j = A("j")
n = B("n")
f = C("f")
h = D("h")
i = E("i")
a = F("a")
m = C("m")

j.r = n
j.p = n
j.u = n
j.x = i
n.s = f
n.r = m
f.q = j
f.z = j
f.y = j
h.y = f
h.t = a
h.s = m
h.z = n
i.v = n
a.w = i
a.v = i
a.p = h
a.o = h
a.s = m
m.q = j
m.z = j
m.y = j
assert i.v.s.z.x.v.s.txt == "f"