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

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

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

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

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

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

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

e.s = h
g.z = e
g.p = e
g.s = n
h.y = n
m.p = b
m.v = b
m.x = e
m.w = g
m.r = n
n.s = b
n.p = e
n.y = m
n.u = c
c.u = g
d.y = n
a.u = g
b.p = m
b.v = m
b.x = e
b.w = g
b.r = n
assert h.y.p.s.y.p.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

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

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

e.s = h
g.z = e
g.p = e
g.s = n
h.y = n
m.p = b
m.v = b
m.x = e
m.w = g
m.r = n
n.s = b
n.p = e
n.y = m
n.u = c
c.u = g
d.y = n
a.u = g
b.p = m
b.v = m
b.x = e
b.w = g
b.r = n
assert h.y.p.s.y.p.s.y.txt == "n"