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

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

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

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

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

e = A("e")
g = B("g")
b = C("b")
j = D("j")
h = E("h")
f = B("f")

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

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

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

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

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

e = A("e")
g = B("g")
b = C("b")
j = D("j")
h = E("h")
f = B("f")

e.s = h
e.y = j
g.p = b
g.t = b
g.s = j
g.u = e
b.t = g
b.y = g
b.s = j
b.o = j
j.t = b
j.r = b
j.v = e
h.r = f
f.p = b
f.t = b
f.s = j
f.u = e
assert e.y.v.s.txt == "h"