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

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

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

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

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

d = A("d")
b = B("b")
c = C("c")
l = D("l")
k = E("k")
j = C("j")

d.y = b
d.r = l
b.w = l
b.v = d
b.y = d
c.s = b
c.v = d
c.y = k
l.t = b
l.y = k
l.s = d
k.o = c
j.s = b
j.v = d
j.y = k
assert j.s.y.r.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
c = C("c")
l = D("l")
k = E("k")
j = C("j")

d.y = b
d.r = l
b.w = l
b.v = d
b.y = d
c.s = b
c.v = d
c.y = k
l.t = b
l.y = k
l.s = d
k.o = c
j.s = b
j.v = d
j.y = k
assert j.s.y.r.t.w.t.txt == "b"