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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

b = A("b")
a = B("a")
g = C("g")
i = D("i")
e = E("e")
c = B("c")
h = C("h")

b.r = e
a.x = g
a.w = e
a.v = e
a.t = c
a.s = i
g.x = h
i.w = h
e.o = h
c.x = g
c.w = e
c.v = e
c.t = a
c.s = i
h.x = g
assert c.s.w.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

b = A("b")
a = B("a")
g = C("g")
i = D("i")
e = E("e")
c = B("c")
h = C("h")

b.r = e
a.x = g
a.w = e
a.v = e
a.t = c
a.s = i
g.x = h
i.w = h
e.o = h
c.x = g
c.w = e
c.v = e
c.t = a
c.s = i
h.x = g
assert c.s.w.x.x.txt == "h"