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

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

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

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

h = A("h")
k = B("k")
i = C("i")
j = D("j")
m = A("m")
f = C("f")
n = B("n")
l = B("l")

h.r = m
h.y = f
h.x = i
k.v = j
k.s = j
k.w = j
i.t = f
i.w = l
j.x = k
j.z = l
j.p = f
m.r = h
m.y = i
m.x = f
f.t = i
f.w = l
n.v = j
n.s = j
n.w = j
l.v = j
l.s = j
l.w = j
assert h.r.y.t.t.w.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: C = None
        self.x: C = None
        self.txt = txt

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

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

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

h = A("h")
k = B("k")
i = C("i")
j = D("j")
m = A("m")
f = C("f")
n = B("n")
l = B("l")

h.r = m
h.y = f
h.x = i
k.v = j
k.s = j
k.w = j
i.t = f
i.w = l
j.x = k
j.z = l
j.p = f
m.r = h
m.y = i
m.x = f
f.t = i
f.w = l
n.v = j
n.s = j
n.w = j
l.v = j
l.s = j
l.w = j
assert h.r.y.t.t.w.w.z.w.txt == "j"