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

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

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

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

g = A("g")
j = B("j")
k = C("k")
h = D("h")
n = C("n")
m = D("m")
b = B("b")

g.z = k
j.o = n
k.w = b
k.r = g
k.o = h
h.t = g
h.v = g
h.s = n
h.p = k
n.w = b
n.r = g
n.o = h
m.t = g
m.v = g
m.s = k
m.p = k
b.o = n
assert j.o.o.s.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
k = C("k")
h = D("h")
n = C("n")
m = D("m")
b = B("b")

g.z = k
j.o = n
k.w = b
k.r = g
k.o = h
h.t = g
h.v = g
h.s = n
h.p = k
n.w = b
n.r = g
n.o = h
m.t = g
m.v = g
m.s = k
m.p = k
b.o = n
assert j.o.o.s.r.z.txt == "k"