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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: E = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
n = C("n")
g = D("g")
b = E("b")
e = A("e")
c = D("c")

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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: E = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
n = C("n")
g = D("g")
b = E("b")
e = A("e")
c = D("c")

l.q = e
l.x = k
k.u = g
k.o = b
n.y = l
g.t = c
g.v = c
b.s = n
e.q = l
e.x = k
c.t = g
c.v = g
assert k.o.s.y.txt == "l"