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

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

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

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

e = A("e")
b = B("b")
f = C("f")
g = D("g")
k = B("k")
l = B("l")
i = D("i")

e.q = l
b.y = k
b.o = l
f.s = e
f.v = g
g.t = l
k.y = b
k.o = b
l.y = k
l.o = b
i.t = k
assert g.t.y.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
f = C("f")
g = D("g")
k = B("k")
l = B("l")
i = D("i")

e.q = l
b.y = k
b.o = l
f.s = e
f.v = g
g.t = l
k.y = b
k.o = b
l.y = k
l.o = b
i.t = k
assert g.t.y.y.o.txt == "l"