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

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

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

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

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

c = A("c")
l = B("l")
n = C("n")
b = D("b")
g = E("g")
h = B("h")
e = D("e")

c.v = n
c.w = l
l.r = g
l.w = g
l.v = h
l.x = c
n.w = g
b.s = g
b.y = n
g.r = l
h.r = g
h.w = g
h.v = l
h.x = c
e.s = g
e.y = n
assert l.r.r.x.w.w.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

c = A("c")
l = B("l")
n = C("n")
b = D("b")
g = E("g")
h = B("h")
e = D("e")

c.v = n
c.w = l
l.r = g
l.w = g
l.v = h
l.x = c
n.w = g
b.s = g
b.y = n
g.r = l
h.r = g
h.w = g
h.v = l
h.x = c
e.s = g
e.y = n
assert l.r.r.x.w.w.r.r.txt == "g"