class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.x: D = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

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

n = A("n")
c = B("c")
f = C("f")
h = D("h")
g = E("g")

n.s = h
n.x = h
n.p = g
n.o = g
c.s = n
c.t = n
c.u = g
c.p = h
f.t = c
f.p = h
h.p = g
h.v = f
h.r = f
h.y = n
g.t = c
assert n.s.y.x.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.x: D = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

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

n = A("n")
c = B("c")
f = C("f")
h = D("h")
g = E("g")

n.s = h
n.x = h
n.p = g
n.o = g
c.s = n
c.t = n
c.u = g
c.p = h
f.t = c
f.p = h
h.p = g
h.v = f
h.r = f
h.y = n
g.t = c
assert n.s.y.x.p.t.txt == "c"