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

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

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

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

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

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

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

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

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

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

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

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

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