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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

h = A("h")
c = B("c")
b = C("b")
e = D("e")
a = E("a")
n = F("n")
j = E("j")

h.p = n
c.o = a
c.z = b
b.o = j
b.r = e
e.y = c
e.u = j
e.w = n
e.q = a
a.s = n
a.t = e
a.z = e
n.x = c
n.s = h
n.w = h
n.y = b
j.s = n
j.t = e
j.z = e
assert a.s.x.o.s.s.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

h = A("h")
c = B("c")
b = C("b")
e = D("e")
a = E("a")
n = F("n")
j = E("j")

h.p = n
c.o = a
c.z = b
b.o = j
b.r = e
e.y = c
e.u = j
e.w = n
e.q = a
a.s = n
a.t = e
a.z = e
n.x = c
n.s = h
n.w = h
n.y = b
j.s = n
j.t = e
j.z = e
assert a.s.x.o.s.s.p.y.txt == "b"