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

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

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

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

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

l.t = c
l.r = c
l.w = j
c.y = d
c.o = j
c.w = l
k.t = n
k.r = n
k.s = j
k.o = m
a.t = n
n.t = c
n.r = c
n.w = a
d.t = n
d.r = n
d.s = j
d.o = k
m.t = n
m.r = l
m.s = a
m.o = d
j.t = l
assert k.t.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

l.t = c
l.r = c
l.w = j
c.y = d
c.o = j
c.w = l
k.t = n
k.r = n
k.s = j
k.o = m
a.t = n
n.t = c
n.r = c
n.w = a
d.t = n
d.r = n
d.s = j
d.o = k
m.t = n
m.r = l
m.s = a
m.o = d
j.t = l
assert k.t.t.y.txt == "d"