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

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

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

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

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

b.r = c
b.s = f
b.w = f
e.u = l
g.o = m
g.z = j
g.r = n
m.z = j
c.r = b
c.s = f
c.w = f
f.o = m
f.r = m
f.z = j
l.u = k
j.o = n
j.z = f
j.r = m
n.z = g
k.u = e
assert b.r.r.s.z.r.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

b.r = c
b.s = f
b.w = f
e.u = l
g.o = m
g.z = j
g.r = n
m.z = j
c.r = b
c.s = f
c.w = f
f.o = m
f.r = m
f.z = j
l.u = k
j.o = n
j.z = f
j.r = m
n.z = g
k.u = e
assert b.r.r.s.z.r.z.z.txt == "f"