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

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

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

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

k = A("k")
l = B("l")
c = C("c")
f = D("f")
m = A("m")
g = A("g")
a = B("a")
n = B("n")
j = B("j")
b = C("b")

k.p = g
k.s = f
k.w = m
l.s = a
c.r = l
c.x = j
c.t = j
c.o = m
f.u = c
m.p = g
m.s = f
m.w = k
g.p = m
g.s = f
g.w = k
a.s = l
n.s = a
j.s = l
b.r = j
b.x = j
b.o = k
b.t = a
assert f.u.r.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: D = None
        self.w: A = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
c = C("c")
f = D("f")
m = A("m")
g = A("g")
a = B("a")
n = B("n")
j = B("j")
b = C("b")

k.p = g
k.s = f
k.w = m
l.s = a
c.r = l
c.x = j
c.t = j
c.o = m
f.u = c
m.p = g
m.s = f
m.w = k
g.p = m
g.s = f
g.w = k
a.s = l
n.s = a
j.s = l
b.r = j
b.x = j
b.o = k
b.t = a
assert f.u.r.s.s.txt == "l"