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

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

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

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

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

l = A("l")
d = B("d")
k = C("k")
i = D("i")
j = E("j")
g = B("g")

l.q = g
d.s = j
d.w = g
k.o = i
i.y = j
i.t = k
j.y = l
g.s = j
g.w = d
assert i.t.o.y.y.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
k = C("k")
i = D("i")
j = E("j")
g = B("g")

l.q = g
d.s = j
d.w = g
k.o = i
i.y = j
i.t = k
j.y = l
g.s = j
g.w = d
assert i.t.o.y.y.q.s.txt == "j"