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

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

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

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

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

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

c.y = e
c.r = a
c.w = b
e.w = b
e.z = g
e.s = g
m.u = b
m.t = c
a.w = b
b.o = m
b.y = a
g.u = b
g.t = c
assert c.w.y.w.o.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: D = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

c.y = e
c.r = a
c.w = b
e.w = b
e.z = g
e.s = g
m.u = b
m.t = c
a.w = b
b.o = m
b.y = a
g.u = b
g.t = c
assert c.w.y.w.o.t.r.txt == "a"