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

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

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

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

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

f = A("f")
c = B("c")
d = C("d")
h = D("h")
g = E("g")
b = E("b")

f.w = b
f.s = c
c.o = b
c.r = b
c.w = f
c.p = d
c.s = d
d.t = g
h.s = f
h.u = f
h.y = g
h.z = g
h.w = d
g.x = c
g.u = f
b.x = c
b.u = f
assert c.r.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: B = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
d = C("d")
h = D("h")
g = E("g")
b = E("b")

f.w = b
f.s = c
c.o = b
c.r = b
c.w = f
c.p = d
c.s = d
d.t = g
h.s = f
h.u = f
h.y = g
h.z = g
h.w = d
g.x = c
g.u = f
b.x = c
b.u = f
assert c.r.u.s.txt == "c"