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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

g = A("g")
i = B("i")
e = C("e")
m = D("m")
d = E("d")
j = C("j")
h = B("h")
l = D("l")
a = D("a")
k = B("k")

g.r = j
g.w = e
g.v = l
g.p = a
g.q = k
i.y = k
i.v = g
e.r = d
e.p = d
e.x = a
e.s = a
e.v = m
m.o = g
d.r = g
j.r = d
j.p = d
j.x = l
j.v = a
j.s = m
h.y = k
h.v = g
l.o = g
a.o = g
k.y = h
k.v = g
assert l.o.w.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.v: D = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

g = A("g")
i = B("i")
e = C("e")
m = D("m")
d = E("d")
j = C("j")
h = B("h")
l = D("l")
a = D("a")
k = B("k")

g.r = j
g.w = e
g.v = l
g.p = a
g.q = k
i.y = k
i.v = g
e.r = d
e.p = d
e.x = a
e.s = a
e.v = m
m.o = g
d.r = g
j.r = d
j.p = d
j.x = l
j.v = a
j.s = m
h.y = k
h.v = g
l.o = g
a.o = g
k.y = h
k.v = g
assert l.o.w.r.r.txt == "g"