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

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

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

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

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

k = A("k")
h = B("h")
d = C("d")
e = D("e")
b = E("b")
g = B("g")
f = E("f")
l = A("l")

k.u = d
h.y = k
h.r = g
h.q = l
d.s = f
e.r = d
b.s = l
b.t = g
g.y = k
g.r = h
g.q = l
f.s = l
f.t = g
l.u = d
assert d.s.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
h = B("h")
d = C("d")
e = D("e")
b = E("b")
g = B("g")
f = E("f")
l = A("l")

k.u = d
h.y = k
h.r = g
h.q = l
d.s = f
e.r = d
b.s = l
b.t = g
g.y = k
g.r = h
g.q = l
f.s = l
f.t = g
l.u = d
assert d.s.t.y.txt == "k"