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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: E = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

f = A("f")
h = B("h")
n = C("n")
c = D("c")
e = E("e")
j = A("j")
i = C("i")

f.s = h
f.u = j
h.s = j
h.z = e
n.t = c
n.v = c
n.x = e
c.o = h
e.s = n
j.s = h
j.u = f
i.t = c
i.v = c
i.x = e
assert i.x.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: E = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

f = A("f")
h = B("h")
n = C("n")
c = D("c")
e = E("e")
j = A("j")
i = C("i")

f.s = h
f.u = j
h.s = j
h.z = e
n.t = c
n.v = c
n.x = e
c.o = h
e.s = n
j.s = h
j.u = f
i.t = c
i.v = c
i.x = e
assert i.x.s.x.s.txt == "n"