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

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

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

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

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

f = A("f")
c = B("c")
j = C("j")
a = D("a")
i = E("i")
d = E("d")

f.s = j
c.u = a
j.r = c
j.o = f
j.x = i
j.p = a
a.v = c
a.p = c
a.z = i
a.x = j
i.s = a
i.o = a
i.p = d
i.u = d
i.w = d
d.s = a
d.o = a
d.p = i
d.u = i
d.w = i
assert f.s.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
j = C("j")
a = D("a")
i = E("i")
d = E("d")

f.s = j
c.u = a
j.r = c
j.o = f
j.x = i
j.p = a
a.v = c
a.p = c
a.z = i
a.x = j
i.s = a
i.o = a
i.p = d
i.u = d
i.w = d
d.s = a
d.o = a
d.p = i
d.u = i
d.w = i
assert f.s.x.p.txt == "d"