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

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

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

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

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

a = A("a")
l = B("l")
g = C("g")
d = D("d")
k = E("k")
n = C("n")

a.t = k
a.r = l
l.y = d
l.o = d
l.w = a
l.r = a
g.o = n
g.s = n
g.v = a
d.r = a
k.s = a
n.o = g
n.s = g
n.v = a
assert g.v.r.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

a = A("a")
l = B("l")
g = C("g")
d = D("d")
k = E("k")
n = C("n")

a.t = k
a.r = l
l.y = d
l.o = d
l.w = a
l.r = a
g.o = n
g.s = n
g.v = a
d.r = a
k.s = a
n.o = g
n.s = g
n.v = a
assert g.v.r.o.r.txt == "a"