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

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

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

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

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

j = A("j")
f = B("f")
k = C("k")
d = D("d")
g = E("g")

j.s = g
j.x = g
j.r = k
j.w = f
j.o = f
f.s = g
f.w = g
f.o = g
f.t = j
k.u = g
k.x = j
d.v = j
g.y = f
assert d.v.r.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: C = None
        self.w: B = None
        self.x: E = None
        self.o: B = None
        self.txt = txt

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

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

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

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

j = A("j")
f = B("f")
k = C("k")
d = D("d")
g = E("g")

j.s = g
j.x = g
j.r = k
j.w = f
j.o = f
f.s = g
f.w = g
f.o = g
f.t = j
k.u = g
k.x = j
d.v = j
g.y = f
assert d.v.r.u.y.txt == "f"