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

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

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

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

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

d = A("d")
k = B("k")
c = C("c")
m = D("m")
f = E("f")
l = C("l")
n = B("n")
j = E("j")

d.s = k
k.u = m
k.t = n
c.q = n
c.v = d
m.r = d
m.t = d
f.o = c
l.q = n
l.v = d
n.u = m
n.t = k
j.o = l
assert d.s.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
c = C("c")
m = D("m")
f = E("f")
l = C("l")
n = B("n")
j = E("j")

d.s = k
k.u = m
k.t = n
c.q = n
c.v = d
m.r = d
m.t = d
f.o = c
l.q = n
l.v = d
n.u = m
n.t = k
j.o = l
assert d.s.t.u.txt == "m"